How to use replaceState in mutations ?
-
Hello all.
I would like to replaceState with localStorage data.
Unfortunately, i don’t understand how i can access to the Vuex Store object in mutations.js file.
Can you help me ?Thanks in advance.
-
By default a mutation is given a state parameter.
-
@AtChA said in How to use replaceState in mutations ?:
Hello all.
I would like to replaceState with localStorage data.
Unfortunately, i don’t understand how i can access to the Vuex Store object in mutations.js file.
Can you help me ?Thanks in advance.
You could use vuex-persistedstate plugin to save your store states in localstorage, so a page refresh will still persist your states.
-
Thx guys.
In fact i was searching too far ><. @patryckx effectively, i’ve just put my localStorage.getItem result into my state.
Sometimes i’m just so into it and i can’t see above my nose :d.
I close the topic.