* feat: responsive * fix: success register * feat: auth login responsive && auth login implementation * fix: login page button disabled & register page * fix: conflict * fix: button disabled when loading * feat: register and otp integration * Update middleware.ts * feat: OTP Resend
26 lines
607 B
TypeScript
26 lines
607 B
TypeScript
import { TSendOTPRequest, usePostSendOTP } from '@imphnen-frontend-service/service';
|
|
import { toast } from 'sonner';
|
|
|
|
export const useSendOTP = () => {
|
|
const { mutate, isPending } = usePostSendOTP();
|
|
|
|
const resendOTP = (payload: TSendOTPRequest) => {
|
|
mutate(payload, {
|
|
onSuccess: (data) => {
|
|
toast.success('Berhasil Mengirim Ulang OTP');
|
|
},
|
|
onError: (err) => {
|
|
toast.error(
|
|
err?.response?.data?.message ??
|
|
'Terjadi Kesalahan yang tidak diketahui'
|
|
);
|
|
},
|
|
});
|
|
};
|
|
|
|
return {
|
|
resendOTP,
|
|
isLoading: isPending,
|
|
};
|
|
};
|