Presupuestador_web/client/src/lib/hooks/useAuth/useIsLoggedIn.tsx

17 lines
479 B
TypeScript
Raw Normal View History

2024-06-06 11:05:54 +00:00
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,
});
};