From e8dbb540866bb8b89dbfd05dc3f6c464a5f0a6a2 Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Sat, 29 Jan 2022 23:26:57 +0000 Subject: [PATCH] Merge stores and handle fetching from router --- web/src/main.js | 9 +++ web/src/pages/Account.vue | 11 --- web/src/pages/BudgetSidebar.vue | 10 +-- web/src/pages/Dashboard.vue | 8 -- web/src/store/index.js | 115 +++++++++++++++++++++++++---- web/src/store/modules/dashboard.js | 110 --------------------------- 6 files changed, 111 insertions(+), 152 deletions(-) delete mode 100644 web/src/store/modules/dashboard.js diff --git a/web/src/main.js b/web/src/main.js index cb1f72a..68dfa0f 100644 --- a/web/src/main.js +++ b/web/src/main.js @@ -12,3 +12,12 @@ app.use(router) app.use(store) app.use(vuetify) app.mount('#app') + +router.beforeEach(async (to, from, next) => { + await store.dispatch("setCurrentBudget", to.params.budgetid); + await store.dispatch("setCurrentAccount", { + accountid: to.params.accountid, + budgetid: to.params.budgetid + }); + next(); +}) diff --git a/web/src/pages/Account.vue b/web/src/pages/Account.vue index b166ca6..88890cb 100644 --- a/web/src/pages/Account.vue +++ b/web/src/pages/Account.vue @@ -1,13 +1,5 @@ @@ -21,9 +13,6 @@ export default { - diff --git a/web/src/pages/BudgetSidebar.vue b/web/src/pages/BudgetSidebar.vue index 3ef8ea9..2b934c7 100644 --- a/web/src/pages/BudgetSidebar.vue +++ b/web/src/pages/BudgetSidebar.vue @@ -1,11 +1,7 @@
{{transaction.Date.substring(0, 10)}} {{transaction.Payee}}