79257899

Date: 2024-12-06 12:01:34
Score: 3.5
Natty:
Report link

You are relying on client-side validation, which is not recommended in Next.js. Instead, you should handle redirection to the login page on the server-side component. Additionally, it is better to use cookies for session management rather than local storage.

You can find a complete guide here: Next.js Authentication Documentation.

It would be helpful if you edit your question to clarify how you are storing the token. Are you using a separate server API, or are you relying on Next.js server actions?

Reasons:
  • No code block (0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Zain