L
L
larik laravue2019-10-01 00:59:33
Vue.js
larik laravue, 2019-10-01 00:59:33

Are there any contraindications against storing an array of site sections in local storage?

I am moving my SPA application to Vuex. I would like to clarify a couple of points.
After login, the application receives a token and expired_data - I immediately put these values ​​​​in localstorage and in parallel I enter these parameters in the state as well as the username. But every time I have a static menu loaded. Is it possible for me to store it in local storage and, when loading the application, check for its presence there and, if it is, then load it from there, and not send a request to the server? I also put it in state. but this is not enough, because when the site is reloaded, the data will not be saved.
Is it correct to take the token data from the storage when opening the application and fill in the state with it and automatically, it turns out to give access to the admin panel without the requirement to log in?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2019-10-01
@rPman

Is it better to use the browser cache? This is logical and much more convenient than keeping such data in a separate storage, keeping track of its format, etc.
Upload your menu with a separate request, specify its expiration time in the headers, and the browser itself will control whether this menu is in the cache or not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question