Skip to content

Commit

Permalink
Restore redirect rule
Browse files Browse the repository at this point in the history
  • Loading branch information
timpau authored Apr 3, 2024
1 parent 8bb6df0 commit 5ab415b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions frontend/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5ab415b

Please sign in to comment.