Next.js Discord

Discord Forum

Detect user status

Unanswered
Lionhead posted this in #help-forum
Open in Discord
LionheadOP
Hello, when the user manually goes to '/login' in my website I need to check the next-auth status so there are 3 cases:

-loading (just return null until the user status has been received)

-unauthenticated (show the login form so the user can enter his credentials)

-authenticated (redirect the user to '/dashboard')

So my problem is when detecting the 'authenticated' status, an error occur in the console of:

Warning: Cannot update a component (Router) while rendering a different component (Login). To locate the bad setState() call inside Login

0 Replies