mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
20 lines
532 B
TypeScript
20 lines
532 B
TypeScript
![]() |
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 {
|
||
|
requestPasswordReset: (
|
||
|
data: IRequestPasswordDTO, //
|
||
|
onSuccess?: () => void
|
||
|
) => mutation.mutate(data, { onSuccess }),
|
||
|
isPending: mutation.isPending,
|
||
|
error: mutation.error,
|
||
|
reset: mutation.reset
|
||
|
};
|
||
|
};
|