First step from vuex to pinia
This commit is contained in:
@ -21,7 +21,22 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
beforeCreate () {
|
||||
this.$store.commit("initializeStore");
|
||||
const store = localStorage.getItem("store");
|
||||
if (!store)
|
||||
return;
|
||||
|
||||
const restoredState = JSON.parse(store);
|
||||
if (!restoredState)
|
||||
return;
|
||||
|
||||
state.Session = restoredState.Session;
|
||||
state.CurrentBudgetID = restoredState.CurrentBudgetID;
|
||||
state.ShowMenu = restoredState.ShowMenu;
|
||||
state.ExpandMenu = restoredState.ExpandMenu;
|
||||
|
||||
for (const budget of restoredState.Budgets || []) {
|
||||
state.Budgets.set(budget[0], budget[1]);
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user