Where to store the data about the current user when writing a spa vue.js 2?

Hello! Learning to write spa vue.js 2.

There is a problem, don't know where to store the data about the current user. Tried to use vuex and store the current user in the $store.state, but when you restart the app, the data is also updated and you have to sign in again.

I would be grateful if constructively explain how such problems are solved on vue.js

Thank you.
August 19th 19 at 23:27
2 answers
August 19th 19 at 23:29
localstorage/session, you can keep anything I spa realized. But to take this data to the application logic still not worth it.
Can also with every update of the first entry point vue.js 2, to send a request to server and get response is sesia or not, and write in the service or where they write in vue.js. So you can do when you change each page it's pretty safe but expensive at the same time.
In any case, on the server on all the closed APIs should be checking for the access level of the session.

The server should never trust client side.
Thank you for the detailed answer! - chanelle_Stamm51 commented on August 19th 19 at 23:32
August 19th 19 at 23:31
localstorage, it is necessary to store not data and web-token

Find more questions by tags JavaScript