diff options
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/my/tempo/index.jsx | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/src/pages/my/tempo/index.jsx b/src/pages/my/tempo/index.jsx index 0c6fc0fb..6ca5c718 100644 --- a/src/pages/my/tempo/index.jsx +++ b/src/pages/my/tempo/index.jsx @@ -13,36 +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.partnerTempo && (!auth.partnerTempo || auth.tempoProgres === 'review') ) { + 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> + ); + } } |
