From 86076ff1d74c95357bd1da9644aca61c9deba79e Mon Sep 17 00:00:00 2001 From: Muhammad Fajar Date: Mon, 5 Dec 2022 08:54:24 +0700 Subject: [PATCH] fix notification login --- frontend/client-portal/src/pages/Dashboard/Dashboard.tsx | 2 -- .../client-portal/src/sections/auth/login/LoginEmailForm.tsx | 5 +++++ .../client-portal/src/sections/auth/login/LoginPhoneForm.tsx | 5 +++++ .../client-portal/src/sections/auth/login/VerifyCodeForm.tsx | 5 +++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/frontend/client-portal/src/pages/Dashboard/Dashboard.tsx b/frontend/client-portal/src/pages/Dashboard/Dashboard.tsx index d9da4786..17937595 100755 --- a/frontend/client-portal/src/pages/Dashboard/Dashboard.tsx +++ b/frontend/client-portal/src/pages/Dashboard/Dashboard.tsx @@ -8,7 +8,6 @@ import Page from '../../components/Page'; import CardNotification from '../../sections/dashboard/CardNotification'; import CardBalance from '../../sections/dashboard/CardBalance'; import TableList from '../../sections/dashboard/TableList'; -import List from './List'; // ---------------------------------------------------------------------- @@ -57,7 +56,6 @@ export default function Dashboard() { - {/* */} diff --git a/frontend/client-portal/src/sections/auth/login/LoginEmailForm.tsx b/frontend/client-portal/src/sections/auth/login/LoginEmailForm.tsx index 1a3ba1b3..e393c4bd 100755 --- a/frontend/client-portal/src/sections/auth/login/LoginEmailForm.tsx +++ b/frontend/client-portal/src/sections/auth/login/LoginEmailForm.tsx @@ -11,6 +11,7 @@ import useAuth from '../../../hooks/useAuth'; import useIsMountedRef from '../../../hooks/useIsMountedRef'; /* ------------------------------- components ------------------------------- */ import { FormProvider, RHFTextField } from '../../../components/hook-form'; +import { enqueueSnackbar } from 'notistack'; /* ---------------------------------- types --------------------------------- */ @@ -56,6 +57,10 @@ export default function LoginForm({ setEmailOrPhone, setLoginOrVerifyCode }: Log setEmailOrPhone(data.email); setLoginOrVerifyCode(true); reset(); + enqueueSnackbar('Kode OTP telah dikirim, silahkan cek email yang login', { + variant: 'success', + autoHideDuration: 2000, + }); } catch (error: any) { reset(); diff --git a/frontend/client-portal/src/sections/auth/login/LoginPhoneForm.tsx b/frontend/client-portal/src/sections/auth/login/LoginPhoneForm.tsx index 2309a6cd..40f4f716 100755 --- a/frontend/client-portal/src/sections/auth/login/LoginPhoneForm.tsx +++ b/frontend/client-portal/src/sections/auth/login/LoginPhoneForm.tsx @@ -11,6 +11,7 @@ import { FormProvider, RHFTextField } from '../../../components/hook-form'; /* ---------------------------------- hooks --------------------------------- */ import useAuth from '../../../hooks/useAuth'; import useIsMountedRef from '../../../hooks/useIsMountedRef'; +import { enqueueSnackbar } from 'notistack'; /* ---------------------------------- types --------------------------------- */ @@ -56,6 +57,10 @@ export default function LoginPhoneForm({ setEmailOrPhone, setLoginOrVerifyCode } setEmailOrPhone(0 + data.phone); setLoginOrVerifyCode(true); reset(); + enqueueSnackbar('Kode OTP telah dikirim, silahkan cek pada nomor yang telah login', { + variant: 'success', + autoHideDuration: 2000, + }); } catch (error: any) { reset(); diff --git a/frontend/client-portal/src/sections/auth/login/VerifyCodeForm.tsx b/frontend/client-portal/src/sections/auth/login/VerifyCodeForm.tsx index 47d99760..00b2737e 100755 --- a/frontend/client-portal/src/sections/auth/login/VerifyCodeForm.tsx +++ b/frontend/client-portal/src/sections/auth/login/VerifyCodeForm.tsx @@ -88,7 +88,8 @@ export default function VerifyCodeForm({ const onSubmit = async (data: FormValuesProps) => { try { - await new Promise((resolve) => setTimeout(resolve, 1000)); + 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('')); @@ -101,7 +102,7 @@ export default function VerifyCodeForm({ } navigate('/dashboard'); - enqueueSnackbar('Verify success!', { variant: 'success' }); + enqueueSnackbar('Login Berhasil!', { variant: 'success' }); } catch (error) { console.error(error); }