2025-01-21 20:33:05 +03:00
|
|
|
import { useMutation } from '@tanstack/react-query';
|
|
|
|
|
|
|
|
import { authApi, IRequestPasswordDTO } from './api';
|
|
|
|
|
|
|
|
export const useRequestPasswordReset = () => {
|
|
|
|
const mutation = useMutation({
|
|
|
|
mutationKey: ['request-password-reset'],
|
|
|
|
mutationFn: authApi.requestPasswordReset
|
|
|
|
});
|
|
|
|
return {
|
2025-01-23 19:41:31 +03:00
|
|
|
requestPasswordReset: (
|
|
|
|
data: IRequestPasswordDTO, //
|
|
|
|
onSuccess?: () => void
|
|
|
|
) => mutation.mutate(data, { onSuccess }),
|
2025-01-21 20:33:05 +03:00
|
|
|
isPending: mutation.isPending,
|
|
|
|
error: mutation.error,
|
|
|
|
reset: mutation.reset
|
|
|
|
};
|
|
|
|
};
|