How do I save the user login status in the SSR of Vue?

  1. at present, when we use Vue for SSR refactoring of the project, we can"t find a good way to save the user"s login status because we can"t use the window object. Is there any good way to save the user"s login status?
  2. users have shared Vue SSR before. How to use cookies when requesting data on the server?

but this user"s sharing is based on the fact that the server side is express, and our server api is not written by node.js, so this approach doesn"t work. Is there any good way to recommend it?
if the front end of juejin.im sees this question, I"d like to answer it. Thank you.

Jul.08,2022

save token to cookie first after successful login

clipboard.png

nuxtServerInit action store

clipboard.png

at this time, the login status in the page can be detected, and the test is valid

.
Menu