summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-02-21 15:02:27 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-02-21 15:02:27 +0700
commit95322b2c473da6160af0e3d685ec3d5eb924df05 (patch)
treee2909cac4b0a021e2d9108f8a19b588bce7dc979 /src
parenta7160110ab082109e96696c3bc2321f28610958c (diff)
<iman> update code /my/tempo
Diffstat (limited to 'src')
-rw-r--r--src/pages/my/tempo/index.jsx54
1 files changed, 28 insertions, 26 deletions
diff --git a/src/pages/my/tempo/index.jsx b/src/pages/my/tempo/index.jsx
index 5fb9deba..6ca5c718 100644
--- a/src/pages/my/tempo/index.jsx
+++ b/src/pages/my/tempo/index.jsx
@@ -13,39 +13,41 @@ export default function MyTempo() {
const router = useRouter();
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
+ setIsLoading(true);
if (!auth) {
const nextUrl = encodeURIComponent(router.asPath);
router.push(`/login?next=${nextUrl}`);
- }
- // else if (
- // (auth.tempoProgres === '' || auth.tempoProgres === 'rejected') &&
- // !auth.company
- // ) {
- // router.push('/pengajuan-tempo');
- // }
- else {
+ } else {
+ if (
+ !auth.partnerTempo &&
+ (!auth.partnerTempo || auth.tempoProgres === 'review')
+ ) {
+ setIsLoading(true);
+ router.push('/pengajuan-tempo');
+ }
setIsLoading(false);
}
}, [auth]);
- if (isLoading || !auth) {
- return null; // Tidak render apa pun selama loading atau auth/tempo belum tersedia
- }
- return (
- <IsAuth>
- <Seo title='Tempo - Indoteknik.com' />
+ if (isLoading && !auth) {
+ return null;
+ } else {
+ return (
+ <IsAuth>
+ <Seo title='Tempo - Indoteknik.com' />
- <MobileView>
- <AppLayout title='Pembayaran Tempo'>
- <InvoicesComponent />
- </AppLayout>
- </MobileView>
+ <MobileView>
+ <AppLayout title='Pembayaran Tempo'>
+ <InvoicesComponent />
+ </AppLayout>
+ </MobileView>
- <DesktopView>
- <BasicLayout>
- <InvoicesComponent />
- </BasicLayout>
- </DesktopView>
- </IsAuth>
- );
+ <DesktopView>
+ <BasicLayout>
+ <InvoicesComponent />
+ </BasicLayout>
+ </DesktopView>
+ </IsAuth>
+ );
+ }
}