16 lines
664 B
TypeScript
16 lines
664 B
TypeScript
import { useMutation, UseMutationOptions } from '@tanstack/react-query';
|
|
import { useInject } from '@/lib/di/hooks/useInject';
|
|
import { AUTH_SERVICE_TOKEN } from '@/lib/di/tokens';
|
|
import { ApiError } from '@/lib/api/base/ApiError';
|
|
import type { ResetPasswordDTO } from '@/lib/types/generated/ResetPasswordDTO';
|
|
|
|
export function useResetPassword(
|
|
options?: Omit<UseMutationOptions<{ message: string }, ApiError, ResetPasswordDTO>, 'mutationFn'>
|
|
) {
|
|
const authService = useInject(AUTH_SERVICE_TOKEN);
|
|
|
|
return useMutation<{ message: string }, ApiError, ResetPasswordDTO>({
|
|
mutationFn: (params) => authService.resetPassword(params),
|
|
...options,
|
|
});
|
|
} |