Open source personal finance application
change all localStorage vars to finapp
ilkome0c9b87c67043
diff --git a/components/stat/chart/ChartMenu.vue b/components/stat/chart/ChartMenu.vueindex b1fdebe9..758ee8b0 100644--- a/components/stat/chart/ChartMenu.vue+++ b/components/stat/chart/ChartMenu.vue@@ -46,7 +46,7 @@ export default {},saveChartsPeriodsToLocalStorage () {- localforage.setItem('next.chart.periods', this.periods)+ localforage.setItem('finapp.chart.periods', this.periods)this.$store.dispatch('ui/saveUiView')}}diff --git a/components/stat/chart/ChartMenu2.vue b/components/stat/chart/ChartMenu2.vueindex dc903f93..c18f2eba 100644--- a/components/stat/chart/ChartMenu2.vue+++ b/components/stat/chart/ChartMenu2.vue@@ -55,7 +55,7 @@ export default {},saveChartsPeriodsToLocalStorage () {- localforage.setItem('next.chart.periods', this.periods)+ localforage.setItem('finapp.chart.periods', this.periods)this.$store.dispatch('ui/saveUiView')}}diff --git a/store/app/actions.js b/store/app/actions.jsindex 71de1e11..d8782cfa 100644--- a/store/app/actions.js+++ b/store/app/actions.js@@ -51,13 +51,13 @@ export default {dispatch('chart/initChart', null, { root: true })const [ativeTab, user, currencies, categories, wallets, trns, filterPeriod] = await Promise.all([- localforage.getItem('next.activeTab'),- localforage.getItem('next.user'),- localforage.getItem('next.currencies'),- localforage.getItem('next.categories'),- localforage.getItem('next.wallets'),- localforage.getItem('next.trns'),- localforage.getItem('next.filter.period')+ localforage.getItem('finapp.activeTab'),+ localforage.getItem('finapp.user'),+ localforage.getItem('finapp.currencies'),+ localforage.getItem('finapp.categories'),+ localforage.getItem('finapp.wallets'),+ localforage.getItem('finapp.trns'),+ localforage.getItem('finapp.filter.period')])if (ativeTab) { dispatch('ui/setActiveTab', ativeTab, { root: true }) }diff --git a/store/categories/actions.js b/store/categories/actions.jsindex df9fe927..56db2f76 100644--- a/store/categories/actions.js+++ b/store/categories/actions.js@@ -13,7 +13,7 @@ export default {setCategories ({ commit }, items) {commit('setCategories', items)- localforage.setItem('next.categories', items)+ localforage.setItem('finapp.categories', items)},unsubcribeCategories ({ rootState }) {diff --git a/store/chart/actions.js b/store/chart/actions.jsindex 506cdefe..7eba374c 100644--- a/store/chart/actions.js+++ b/store/chart/actions.js@@ -2,7 +2,7 @@ import localforage from 'localforage'export default {async initChart ({ rootState, commit }) {- const localPeriods = await localforage.getItem('next.chart.periods')+ const localPeriods = await localforage.getItem('finapp.chart.periods')let showedGroups, showedPeriodsif (!localPeriods) { return }diff --git a/store/currencies/actions.js b/store/currencies/actions.jsindex 6506da5c..f6aacf03 100644--- a/store/currencies/actions.js+++ b/store/currencies/actions.js@@ -30,7 +30,7 @@ export default {const currencies = { base: userCurrency, rates }commit('setCurrencies', currencies)- localforage.setItem('next.currencies', currencies)+ localforage.setItem('finapp.currencies', currencies)},setBaseCurrency ({ rootState, dispatch }, baseCurrency) {diff --git a/store/filter/actions.js b/store/filter/actions.jsindex 48af63b0..739ed5e6 100644--- a/store/filter/actions.js+++ b/store/filter/actions.js@@ -37,7 +37,7 @@ export default {setPeriod ({ commit, dispatch }, period) {commit('setPeriod', period)commit('setDate', dayjs().valueOf())- localforage.setItem('next.filter.period', period)+ localforage.setItem('finapp.filter.period', period)dispatch('ui/saveUiView', null, { root: true })},diff --git a/store/trns/actions.js b/store/trns/actions.jsindex 354dea11..21120f9f 100644--- a/store/trns/actions.js+++ b/store/trns/actions.js@@ -26,7 +26,7 @@ export default {walletId: values.walletId}- localforage.setItem('next.trns', { ...trns, [id]: formatedTrnValues })+ localforage.setItem('finapp.trns', { ...trns, [id]: formatedTrnValues })commit('setTrns', Object.freeze({ ...trns, [id]: formatedTrnValues }))db.ref(`users/${uid}/trns/${id}`)@@ -55,7 +55,7 @@ export default {delete trns[id]commit('setTrns', Object.freeze(trns))- localforage.setItem('next.trns', trns)+ localforage.setItem('finapp.trns', trns)saveTrnToDeleteLaterLocal(id)db.ref(`users/${uid}/trns/${id}`)@@ -107,7 +107,7 @@ export default {setTrns ({ commit }, items) {commit('setTrns', items)- localforage.setItem('next.trns', items)+ localforage.setItem('finapp.trns', items)},unsubcribeTrns ({ rootState }) {@@ -120,7 +120,7 @@ export default {const isConnected = snap.val()if (isConnected) {// add- const trnsOfflineUpdate = await localforage.getItem('next.trns.offline.update') || {}+ const trnsOfflineUpdate = await localforage.getItem('finapp.trns.offline.update') || {}for (const trnId in trnsOfflineUpdate) {if (trnsOfflineUpdate[trnId] && trnsOfflineUpdate[trnId].amount) {dispatch('addTrn', {@@ -130,7 +130,7 @@ export default {}}// delete- const trnsOfflineDelete = await localforage.getItem('next.trns.offline.delete') || []+ const trnsOfflineDelete = await localforage.getItem('finapp.trns.offline.delete') || []for (const trnId of trnsOfflineDelete) {dispatch('deleteTrn', trnId)}diff --git a/store/trns/helpers.js b/store/trns/helpers.jsindex 57758f3f..5b24b0e0 100644--- a/store/trns/helpers.js+++ b/store/trns/helpers.js@@ -2,8 +2,8 @@ import localforage from 'localforage'// save added trn to localexport const saveTrnToAddLaterLocal = async ({ id, values }) => {- const trns = await localforage.getItem('next.trns.offline.update')- await localforage.setItem('next.trns.offline.update', {+ const trns = await localforage.getItem('finapp.trns.offline.update')+ await localforage.setItem('finapp.trns.offline.update', {...trns,[id]: values})@@ -11,17 +11,17 @@ export const saveTrnToAddLaterLocal = async ({ id, values }) => {// remove added trn from localexport const removeTrnToAddLaterLocal = async (id) => {- const trns = await localforage.getItem('next.trns.offline.update') || {}+ const trns = await localforage.getItem('finapp.trns.offline.update') || {}if (trns[id]) {delete trns[id]- await localforage.setItem('next.trns.offline.update', trns || {})+ await localforage.setItem('finapp.trns.offline.update', trns || {})}}// save deleted trn to localexport const saveTrnToDeleteLaterLocal = async (id) => {- const trnsIds = await localforage.getItem('next.trns.offline.delete') || []- await localforage.setItem('next.trns.offline.delete', [+ const trnsIds = await localforage.getItem('finapp.trns.offline.delete') || []+ await localforage.setItem('finapp.trns.offline.delete', [...trnsIds,id])@@ -29,10 +29,10 @@ export const saveTrnToDeleteLaterLocal = async (id) => {// remove deleted trn from localexport const removeTrnToDeleteLaterLocal = async (id) => {- const trnsIds = await localforage.getItem('next.trns.offline.delete') || []+ const trnsIds = await localforage.getItem('finapp.trns.offline.delete') || []const trnId = trnsIds.find(trnId => trnId === id)if (trnId) {- await localforage.setItem('next.trns.offline.delete', [+ await localforage.setItem('finapp.trns.offline.delete', [...trnsIds.filter(trnId => trnId !== id)])}diff --git a/store/ui/actions.js b/store/ui/actions.jsindex ce03f036..3d5294a1 100644--- a/store/ui/actions.js+++ b/store/ui/actions.js@@ -63,7 +63,7 @@ export default {setActiveTab ({ commit, state }, nextTab) {if (state.activeTab !== nextTab) {commit('setActiveTab', nextTab)- localforage.setItem('next.activeTab', nextTab)+ localforage.setItem('finapp.activeTab', nextTab)}},@@ -143,7 +143,7 @@ export default {* Save ui view state to localStorage for selected filter*/async saveUiView ({ commit, dispatch, state, rootState }) {- const localName = 'finappUiView'+ const localName = 'finapp.statViewConfig'const localFilterUi = await localforage.getItem(localName)const walletName = rootState.filter.walletId || 'root'const categoryName = rootState.filter.categoryId || 'root'@@ -168,7 +168,7 @@ export default {* Set ui view params for selected filter*/async setUiView ({ commit, dispatch, state, rootState }) {- const localName = 'finappUiView'+ const localName = 'finapp.statViewConfig'const localFilterUi = await localforage.getItem(localName)const walletName = rootState.filter.walletId || 'root'const categoryName = rootState.filter.categoryId || 'root'diff --git a/store/user/actions.js b/store/user/actions.jsindex a9c6b8f0..ec9b7c0a 100644--- a/store/user/actions.js+++ b/store/user/actions.js@@ -20,7 +20,7 @@ export default {setUser ({ commit }, user) {commit('setUser', user)- localforage.setItem('next.user', user)+ localforage.setItem('finapp.user', user)},async signOut ({ rootState, commit, dispatch }) {diff --git a/store/wallets/actions.js b/store/wallets/actions.jsindex f87bf586..54aa394e 100644--- a/store/wallets/actions.js+++ b/store/wallets/actions.js@@ -32,7 +32,7 @@ export default {setWallets ({ commit }, items) {commit('setWallets', items)- localforage.setItem('next.wallets', items)+ localforage.setItem('finapp.wallets', items)},unsubcribeWallets ({ rootGetters }) {