From 6b221cccd58710682c99db7afbc29322da042880 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Tue, 31 Oct 2023 10:44:25 +0700
Subject: - Add redirect after activation - Add register form validation

---
 .../modules/account-activation/components/FormOTP.tsx        | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

(limited to 'src-migrate/modules/account-activation/components/FormOTP.tsx')

diff --git a/src-migrate/modules/account-activation/components/FormOTP.tsx b/src-migrate/modules/account-activation/components/FormOTP.tsx
index a4775d61..47c69329 100644
--- a/src-migrate/modules/account-activation/components/FormOTP.tsx
+++ b/src-migrate/modules/account-activation/components/FormOTP.tsx
@@ -54,8 +54,9 @@ const FormOTP = () => {
   useEffect(() => {
     if (mutationActivation.data?.user) {
       setAuth(mutationActivation.data.user)
+      router.push((query?.redirect || '/') as string)
     }
-  }, [mutationActivation.data])
+  }, [mutationActivation.data, router, query.redirect])
 
   return (
     <Modal active={active} className="w-10/12 md:w-fit px-10" mode="desktop">
@@ -78,10 +79,6 @@ const FormOTP = () => {
               <span className="text-red-700">Mohon maaf kode OTP yand anda masukan salah</span>
             )
           }
-
-          {mutationActivation.data?.activation && (
-            <span className="text-success-700">Akun anda berhasil diaktifkan, selamat berbelanja di Indoteknik.</span>
-          )}
         </div>
 
         {!mutationActivation.data?.activation && (
@@ -108,11 +105,6 @@ const FormOTP = () => {
             </>
           )}
 
-          {mutationActivation.data?.activation && (
-            <Link href='/' className="text-success-700 underline">Kembali ke halaman utama</Link>
-          )}
-
-
         </div>
       </div>
     </Modal>
-- 
cgit v1.2.3

