import { useAuth } from "@/lib/hooks";
import { UseQueryOptions, useQuery } from "@tanstack/react-query";
import { useQueryKey } from "../useQueryKey";

export const useIsLoggedIn = (queryOptions?: UseQueryOptions) => {
  const keys = useQueryKey();
  const { check } = useAuth();

  return useQuery({
    queryKey: keys().auth().action("check").get(),
    queryFn: check,
    ...queryOptions,
  });
};
