Next.js Discord

Discord Forum

I am validation user session in server actions

Unanswered
Cane di Oropa posted this in #help-forum
Open in Discord
Cane di OropaOP
if session is null, what should I return?

4 Replies

@Cane di Oropa if session is null, what should I return?
u can basically just redirect back to the login page or whatever
if i understood ur question, if someone triggers a server action, and at that moment the session is null -> just redirect
Cane di OropaOP
throwing error is bad? instead of redirect
how do i return 401 unauthorize