From 5ab415bf5ee29de183baad63b24f8926431544e9 Mon Sep 17 00:00:00 2001 From: Adrian Timpau Date: Wed, 3 Apr 2024 13:38:08 +0300 Subject: [PATCH] Restore redirect rule --- frontend/pages/_app.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/frontend/pages/_app.tsx b/frontend/pages/_app.tsx index e1054e47..ef6629f5 100644 --- a/frontend/pages/_app.tsx +++ b/frontend/pages/_app.tsx @@ -30,21 +30,20 @@ function useRedirect(isVersionChecked: boolean) { const router = useRouter() - // temp disable to get the nav working - TODO Review this before live // We will only redirect on the first load - // useLayoutEffect(() => { - // if (!isVersionChecked) return - // // These pathnames are being loaded when we have to oauth with Discord - // // We shouldn't be redirecting the user from these pages - // if (pathname === '/discord-login' || pathname === '/discord-logout') return + useLayoutEffect(() => { + if (!isVersionChecked) return + // These pathnames are being loaded when we have to oauth with Discord + // We shouldn't be redirecting the user from these pages + if (pathname === '/discord-login' || pathname === '/discord-logout') return // //RULES: // // 1. no last state -> redirect to welcome page // // 2. there is a last state -> redirect to that page - // if (lastStep === null) router.replace('/') - // if (lastStep) router.replace(lastStep) - // }, [isVersionChecked, lastStep, router, pathname]) + if (lastStep === null) router.replace('/') + if (lastStep) router.replace(lastStep) + }, [isVersionChecked, lastStep, router, pathname]) useEffect(() => { if (!isVersionChecked) return