2026-08-11 21:09:32 +07:00
|
|
|
import { useMutation } from '@tanstack/react-query';
|
|
|
|
|
|
|
|
|
|
import { useAuthStore } from '../store/authStore';
|
|
|
|
|
import type { LoginCredentials } from '../types';
|
|
|
|
|
|
|
|
|
|
export function useLogin() {
|
|
|
|
|
const login = useAuthStore((s) => s.login);
|
|
|
|
|
|
|
|
|
|
return useMutation({
|
2026-08-22 08:24:06 +07:00
|
|
|
mutationFn: (credentials: LoginCredentials) => login(credentials.username, credentials.password),
|
2026-08-11 21:09:32 +07:00
|
|
|
});
|
|
|
|
|
}
|