Next.js Discord

Discord Forum

redirect if logged in

Unanswered
Diamwaw posted this in #help-forum
Open in Discord
Hey I made a redirect if the user is logged in but it doesnt work, do you know why?

7 Replies

Dusky Flycatcher
I think you need to modify some code.
@Dusky Flycatcher I think you need to modify some code.
That is why I'm here, sir.
Dusky Flycatcher
please send me code section for redirect page.
@Dusky Flycatcher please send me code section for redirect page.
Please see the screenshot.
@Dusky Flycatcher
Huh
Siamese Crocodile
Hi, the issue might be that account.get() doesn't immediately return the value creating the session. Check if session is correctly initialized and user data is available. And then make sure that the router.push("/dashboard") is being triggered after verifying the user object. My two cents.