17 lines
511 B
TypeScript
17 lines
511 B
TypeScript
import { AuthActionResponse, useAuth } from "@/lib/hooks";
|
|
import { ILogin_DTO } from "@shared/contexts";
|
|
import { UseMutationOptions, useMutation } from "@tanstack/react-query";
|
|
|
|
import { useQueryKey } from "../useQueryKey";
|
|
|
|
export const useLogin = (params?: UseMutationOptions<AuthActionResponse, Error, ILogin_DTO>) => {
|
|
const keys = useQueryKey();
|
|
const { login } = useAuth();
|
|
|
|
return useMutation({
|
|
mutationKey: keys().auth().action("login").get(),
|
|
mutationFn: login,
|
|
...params,
|
|
});
|
|
};
|