what is the best way to redirect the user to login page in CSR?

I have this jamstack app and I want to redirect unauthenticated user to the login page, in case the session expired he still have the code in the browser to do certain actions. but the cookie is not there.

so in the server I only send a response with 200 status. that says {redirect: true}. and I act in the front based on that.

is this a good way to do it? or is there a more standard way?
Was this page helpful?