2024-06-09 20:04:46 +00:00
|
|
|
import { useAuth } from "@/lib/hooks";
|
|
|
|
|
import { UseQueryOptions, useQuery } from "@tanstack/react-query";
|
2024-06-06 11:05:54 +00:00
|
|
|
import { useQueryKey } from "../useQueryKey";
|
|
|
|
|
|
2024-06-09 20:04:46 +00:00
|
|
|
export const useIsLoggedIn = (queryOptions?: UseQueryOptions) => {
|
2024-06-06 11:05:54 +00:00
|
|
|
const keys = useQueryKey();
|
|
|
|
|
const { check } = useAuth();
|
|
|
|
|
|
2024-06-09 20:04:46 +00:00
|
|
|
return useQuery({
|
|
|
|
|
queryKey: keys().auth().action("check").get(),
|
|
|
|
|
queryFn: check,
|
|
|
|
|
...queryOptions,
|
2024-06-06 11:05:54 +00:00
|
|
|
});
|
|
|
|
|
};
|