#How to achieve this effect in nextJS if

1 messages · Page 1 of 1 (latest)

harsh spindle
#

You mean redirect all routes to /account?

lament pendant
#

no, I meant check if the current route is /account, if it is, refresh it, otherwise, push to it

harsh spindle
#

push to it
not sure what you mean by this

lament pendant
#

router.push

#

or redirect

harsh spindle
#

so yea, you want to redirect all routes to /account, but potentially also push it onto history

lament pendant
#

how to check it first if the current route is /accunt

harsh spindle
#

if the current route is /account refresh it
this sounds like it would create an infinite loop.

#

@lament pendant are you using the app router or the page router?

lament pendant
#

page router

harsh spindle
lament pendant
#

thanks @harsh spindle