Next.js Discord

Discord Forum

redirect if logged in

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

7 Replies

Avatar
Dusky Flycatcher
I think you need to modify some code.
Avatar
@Dusky Flycatcher I think you need to modify some code.
Avatar
That is why I'm here, sir.
Avatar
Dusky Flycatcher
please send me code section for redirect page.
Avatar
@Dusky Flycatcher please send me code section for redirect page.
Avatar
Please see the screenshot.
Avatar
@Dusky Flycatcher
Image
Avatar
Huh
Avatar
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.