diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-12-06 17:06:26 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-12-06 17:06:26 +0700 |
| commit | e9cd13307f0095dc4edc5048752675d80c551564 (patch) | |
| tree | ba133ca989725bd225e3ed1517ddece8a33e3f32 /src/pages | |
| parent | 9a49b8d84761781531cb417731cb9ef802f63541 (diff) | |
<iman> pengajuan tempo
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/pengajuan-tempo/index.jsx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/pages/pengajuan-tempo/index.jsx b/src/pages/pengajuan-tempo/index.jsx index 25db0c4b..271914c3 100644 --- a/src/pages/pengajuan-tempo/index.jsx +++ b/src/pages/pengajuan-tempo/index.jsx @@ -14,19 +14,24 @@ const PagePengajuanTempo = dynamic(() => export default function TrackingOrder() { const auth = getAuth(); + console.log('auth', auth); const router = useRouter(); const [isLoading, setIsLoading] = useState(true); // Set default isLoading to true useEffect(() => { - if (!auth) return; // Prevent unnecessary processing if auth is not ready + // if (!auth) return; // Prevent unnecessary processing if auth is not ready - if (auth.tempoProgres === 'review') { - router.push('/pengajuan-tempo/review'); - } else if (!auth.parentId) { - router.push('/pengajuan-tempo/switch-account'); - } else if (!auth) { + 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') { + router.push('/pengajuan-tempo/review'); + } else if (auth.tempoProgres === 'approve') { + router.push('/pengajuan-tempo/approve'); + } else if (auth.tempoProgres === 'rejected') { + router.push('/pengajuan-tempo/rejected'); } else { setIsLoading(false); // Set isLoading to false only when routing is not required } |
