diff options
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 } |
