fix login & fix logout
This commit is contained in:
@@ -87,25 +87,22 @@ export default function VerifyCodeForm({
|
||||
}, [setValue]);
|
||||
|
||||
const onSubmit = async (data: FormValuesProps) => {
|
||||
try {
|
||||
// @ts-ignore
|
||||
const response: responseProps = await validateOtp(emailOrPhone, Object.values(data).join(''));
|
||||
|
||||
if (response.data.length === 0) {
|
||||
return enqueueSnackbar(response.message, {
|
||||
variant: 'error',
|
||||
autoHideDuration: 4000,
|
||||
preventDuplicate: true,
|
||||
});
|
||||
} else {
|
||||
enqueueSnackbar('Verify success!', { variant: 'success', autoHideDuration: 1000 });
|
||||
await new Promise((resolve) => setTimeout(resolve, 2000));
|
||||
// @ts-ignore
|
||||
const response: responseProps = await validateOtp(emailOrPhone, Object.values(data).join(''));
|
||||
|
||||
if (response.data.length === 0) {
|
||||
return enqueueSnackbar(response.message, {
|
||||
variant: 'error',
|
||||
autoHideDuration: 4000,
|
||||
preventDuplicate: true,
|
||||
});
|
||||
}
|
||||
|
||||
navigate('/dashboard');
|
||||
enqueueSnackbar('Login Berhasil!', { variant: 'success' });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
navigate('/dashboard');
|
||||
enqueueSnackbar('Login Berhasil!', { variant: 'success' });
|
||||
};
|
||||
|
||||
const handleChangeWithNextField = (
|
||||
|
||||
Reference in New Issue
Block a user