import { useMutation } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';
import type { ResetPasswordVerifyParams } from '@/client/models/ResetPasswordVerifyParams';
import { AuthService } from '@/client/services/AuthService';

export function useVerifyPasswordReset() {
  const navigate = useNavigate();

  return useMutation({
    mutationFn: (params: ResetPasswordVerifyParams) =>
      AuthService.authVerifyPasswordReset({ requestBody: params }),
    onSuccess: () => {
      navigate('/auth/login');
    },
  });
}
