fix: toast color change on close fixed (new state for loading)
This commit is contained in:
@@ -23,9 +23,9 @@ export function OtpVerifyForm({
|
|||||||
}: OtpVerifyFormProps) {
|
}: OtpVerifyFormProps) {
|
||||||
const [otpCode, setOtpCode] = useState<string>('');
|
const [otpCode, setOtpCode] = useState<string>('');
|
||||||
const [otpDigitInvalid, setOtpDigitInvalid] = useState<boolean>(false);
|
const [otpDigitInvalid, setOtpDigitInvalid] = useState<boolean>(false);
|
||||||
const [verifyStatus, setVerifyStatus] = useState<
|
const [verifyStatus, setVerifyStatus] = useState<'success' | 'failed'>();
|
||||||
'loading' | 'success' | 'failed'
|
const [verifyStatusLoading, setVerifyStatusLoading] =
|
||||||
>();
|
useState<boolean>(false);
|
||||||
const [verifyAlertOpen, setVerifyAlertOpen] = useState<boolean>(false);
|
const [verifyAlertOpen, setVerifyAlertOpen] = useState<boolean>(false);
|
||||||
const { t } = useTranslation('authentication');
|
const { t } = useTranslation('authentication');
|
||||||
|
|
||||||
@@ -40,13 +40,14 @@ export function OtpVerifyForm({
|
|||||||
setOtpDigitInvalid(true);
|
setOtpDigitInvalid(true);
|
||||||
} else {
|
} else {
|
||||||
setOtpDigitInvalid(false);
|
setOtpDigitInvalid(false);
|
||||||
setVerifyStatus('loading');
|
setVerifyStatusLoading(true);
|
||||||
// Change setTimeout to api call
|
|
||||||
|
|
||||||
|
// Change setTimeout to api call
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setVerifyAlertOpen(true);
|
setVerifyAlertOpen(true);
|
||||||
setVerifyStatus('success');
|
setVerifyStatus('success');
|
||||||
onOTPVerified(otpCode);
|
onOTPVerified(otpCode);
|
||||||
|
setVerifyStatusLoading(false);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -128,7 +129,7 @@ export function OtpVerifyForm({
|
|||||||
onChange={(value) => handleDigitInputChange(value as string[])}
|
onChange={(value) => handleDigitInputChange(value as string[])}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button onClick={handleVerifyOTP} loading={verifyStatus === 'loading'}>
|
<Button onClick={handleVerifyOTP} loading={verifyStatusLoading}>
|
||||||
{authMode === 'register'
|
{authMode === 'register'
|
||||||
? t('verify.confirmAndContinue')
|
? t('verify.confirmAndContinue')
|
||||||
: t('verify.confirmAndLogin')}
|
: t('verify.confirmAndLogin')}
|
||||||
|
|||||||
Reference in New Issue
Block a user