17 lines
479 B
TypeScript
17 lines
479 B
TypeScript
|
|
import { AuthActionCheckResponse, useAuth } from "@/lib/hooks";
|
||
|
|
import { UseMutationOptions, useMutation } from "@tanstack/react-query";
|
||
|
|
import { useQueryKey } from "../useQueryKey";
|
||
|
|
|
||
|
|
export const useIsLoggedIn = (
|
||
|
|
params?: UseMutationOptions<AuthActionCheckResponse, Error, unknown>
|
||
|
|
) => {
|
||
|
|
const keys = useQueryKey();
|
||
|
|
const { check } = useAuth();
|
||
|
|
|
||
|
|
return useMutation({
|
||
|
|
mutationKey: keys().auth().action("check").get(),
|
||
|
|
mutationFn: check,
|
||
|
|
...params,
|
||
|
|
});
|
||
|
|
};
|