Open zpwebbear opened 2 years ago
You invoke the mutation on App.js component beforeCreate hook https://github.com/peterkarnaukhsite/vue-kanban-hierarchical/blob/05dc4f76981778966ee8f1c57c0e496f443411cd/src/App.vue#L19
beforeCreate
But it is the wrong way. You need to get data from the localstorage on the vuex creation. E.g
const defaultState = { nextBoadrId: 0, nextColId: 0, nextTaskId: 0, boards: [], } function getLocalStorageState(){ return JSON.parse(localStorage.getItem("store")) ?? defaultState; } const store = createStore({ state: getLocalStorageState(), //... other state lines
Used your approach but i`ll be thankfull if you comment why my aproach could be buggy or inapropriate?
You invoke the mutation on App.js component
beforeCreate
hook https://github.com/peterkarnaukhsite/vue-kanban-hierarchical/blob/05dc4f76981778966ee8f1c57c0e496f443411cd/src/App.vue#L19But it is the wrong way. You need to get data from the localstorage on the vuex creation. E.g