Files
imphnen-frontend-service/apps/landing/src/app/(auth)/verification/_hooks/use-post-resend-otp.ts
T

19 lines
529 B
TypeScript
Raw Normal View History

import { useMutation } from '@tanstack/react-query';
import { toast } from 'sonner';
import { resendOTPAction } from '../_actions/resend-otp-action';
import { useFormResendOTP } from './use-form-resend-otp';
export function usePostResendOTP(form: ReturnType<typeof useFormResendOTP>) {
return useMutation({
mutationFn: resendOTPAction,
onSuccess: ({ message }) => {
form.reset();
toast.success(message);
},
onError: ({ message }) => {
form.reset();
toast.error(message);
},
});
}