2025-01-27 15:03:48 +03:00
|
|
|
import { useMutation } from '@tanstack/react-query';
|
|
|
|
|
2025-02-19 19:26:29 +03:00
|
|
|
import { KEYS } from '@/backend/configuration';
|
|
|
|
|
2025-02-12 20:53:31 +03:00
|
|
|
import { authApi } from './api';
|
2025-02-21 21:15:05 +03:00
|
|
|
import { type IRequestPasswordDTO } from './types';
|
2025-01-27 15:03:48 +03:00
|
|
|
|
|
|
|
export const useRequestPasswordReset = () => {
|
|
|
|
const mutation = useMutation({
|
2025-02-19 19:26:29 +03:00
|
|
|
mutationKey: [KEYS.auth, 'request-password-reset'],
|
2025-01-27 15:03:48 +03:00
|
|
|
mutationFn: authApi.requestPasswordReset
|
|
|
|
});
|
|
|
|
return {
|
2025-02-11 20:16:11 +03:00
|
|
|
requestPasswordReset: (data: IRequestPasswordDTO) => mutation.mutateAsync(data),
|
2025-01-27 15:03:48 +03:00
|
|
|
isPending: mutation.isPending,
|
|
|
|
error: mutation.error,
|
|
|
|
reset: mutation.reset
|
|
|
|
};
|
|
|
|
};
|