fix login & fix logout

This commit is contained in:
Muhammad Fajar
2022-12-07 02:37:18 +07:00
parent 723c9f1895
commit 2bac2bfeb7
7 changed files with 25 additions and 38 deletions

View File

@@ -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 = (