import { queryOptions } from '@tanstack/react-query';
import { useApi } from '../api/Api';

export const postsQueryOptions = (Api: ReturnType<typeof useApi>, page?: number) =>
  queryOptions({
    queryKey: ['posts', { page: page ?? 0, hasAuth: Api.hasAuth }],
    queryFn: async () => await Api.posts(page),
  });
