From 0f84963214ee6dc5b5a44d945540826a66bec9e0 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 11 Dec 2024 11:51:45 +0700
Subject: <iman> update pengajuan tempo

---
 src/pages/pengajuan-tempo/index.jsx | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

(limited to 'src/pages/pengajuan-tempo/index.jsx')

diff --git a/src/pages/pengajuan-tempo/index.jsx b/src/pages/pengajuan-tempo/index.jsx
index f0681663..d485c721 100644
--- a/src/pages/pengajuan-tempo/index.jsx
+++ b/src/pages/pengajuan-tempo/index.jsx
@@ -41,25 +41,26 @@ export default function TrackingOrder() {
     } else {
       setIsLoading(false);
     }
-  }, [auth]);
-
+  }, []);
   useEffect(() => {
     if (!auth) {
       const nextUrl = encodeURIComponent(router.asPath);
       router.push(`/login?next=${nextUrl}`);
-    } else if (!auth.parentId) {
-      router.push('/pengajuan-tempo/switch-account');
-    } else if (auth.tempoProgres === 'review' && !tempo?.paymentTerm) {
-      router.push('/pengajuan-tempo/review');
     } else if (
       auth.tempoProgres === 'approve' &&
       tempo?.paymentTerm?.toLowerCase().includes('tempo')
     ) {
       router.push('/pengajuan-tempo/approve');
+    } else if (!auth.parentId) {
+      router.push('/pengajuan-tempo/switch-account');
+    } else if (auth.tempoProgres === 'review' && !tempo?.paymentTerm) {
+      router.push('/pengajuan-tempo/review');
     } else if (auth.tempoProgres === 'rejected') {
       router.push('/pengajuan-tempo/rejected');
+    } else {
+      setIsLoading(false);
     }
-  }, [auth, router, tempo]);
+  }, [tempo]);
 
   if (isLoading || !auth || !tempo) {
     return null; // Tidak render apa pun selama loading atau auth/tempo belum tersedia
-- 
cgit v1.2.3

