Use vueuse useStorage instead of manually using localStorage
This commit is contained in:
@ -4,8 +4,6 @@ import './index.css'
|
||||
import router from './router'
|
||||
import { createPinia, SubscriptionCallbackMutation } from 'pinia'
|
||||
import { useBudgetsStore } from './stores/budget';
|
||||
import { useSessionStore } from './stores/session';
|
||||
import { useSettingsStore } from './stores/settings';
|
||||
import { useAccountStore } from './stores/budget-account'
|
||||
import PiniaLogger from './pinia-logger'
|
||||
|
||||
@ -24,13 +22,4 @@ router.beforeEach(async (to, from, next) => {
|
||||
const accountStore = useAccountStore();
|
||||
await accountStore.SetCurrentAccount((<string>to.params.budgetid), (<string>to.params.accountid));
|
||||
next();
|
||||
})
|
||||
|
||||
function saveStateToLocalStorage(mutation : SubscriptionCallbackMutation<any>, state : any) {
|
||||
localStorage.setItem(mutation.storeId, JSON.stringify(state));
|
||||
console.log("saving to local storage", mutation)
|
||||
}
|
||||
|
||||
useSettingsStore().$subscribe(saveStateToLocalStorage);
|
||||
useBudgetsStore().$subscribe(saveStateToLocalStorage);
|
||||
useSessionStore().$subscribe(saveStateToLocalStorage);
|
||||
})
|
Reference in New Issue
Block a user