Merge stores and handle fetching from router

This commit is contained in:
2022-01-29 23:26:57 +00:00
parent 6f7aa28d22
commit e8dbb54086
6 changed files with 111 additions and 152 deletions

View File

@ -1,13 +1,5 @@
<script>
export default {
mounted() {
this.$store.dispatch("setCurrentAccount", {budgetid: this.budgetid, accountid: this.accountid})
},
watch: {
accountid () {
this.$store.dispatch("setCurrentAccount", {budgetid: this.budgetid, accountid: this.accountid})
}
},
props: ["budgetid", "accountid"]
}
</script>
@ -21,9 +13,6 @@ export default {
<table>
<tr v-for="transaction in $store.getters.Transactions" class="{{transaction.Date.After now ? 'future' : ''}}">
<td style="width: 90px;">{{transaction.Date.substring(0, 10)}}</td>
<!--<td>
{{transaction.Account}}
</td>-->
<td style="max-width: 150px;">
{{transaction.Payee}}
</td>

View File

@ -1,11 +1,7 @@
<script>
export default {
props: ['budgetid', 'accountid'],
mounted () {
this.$store.dispatch("setCurrentBudget", this.budgetid)
}
}
</script>
<template>
@ -14,14 +10,14 @@ export default {
{{$store.getters.CurrentBudget.Name}}
</h1>
<ul>
<li><router-link :to="'/budget/'+$store.getters.CurrentBudget.ID">Budget</router-link></li>
<li><router-link :to="'/budget/'+budgetid">Budget</router-link></li>
<li>Reports (Coming Soon)</li>
<!--<li><router-link :to="'/budget/'+$store.getters.CurrentBudget.ID+'/all-accounts'">All Accounts</router-link></li>-->
<li>
On-Budget Accounts
<ul v-for="account in $store.getters.OnBudgetAccounts" class="two-valued">
<li>
<router-link :to="'/budget/'+$store.getters.CurrentBudget.ID+'/account/'+account.ID">{{account.Name}}</router-link>
<router-link :to="'/budget/'+budgetid+'/account/'+account.ID">{{account.Name}}</router-link>
<span>{{account.Balance.Int / 100}}</span>
</li>
</ul>
@ -30,7 +26,7 @@ export default {
Off-Budget Accounts
<ul v-for="account in $store.getters.OffBudgetAccounts" class="two-valued">
<li>
<router-link :to="'/budget/'+$store.getters.CurrentBudget.ID+'/account/'+account.ID">{{account.Name}}</router-link>
<router-link :to="'/budget/'+budgetid+'/account/'+account.ID">{{account.Name}}</router-link>
<span>{{account.Balance.Int / 100}}</span>
</li>
</ul>

View File

@ -3,14 +3,6 @@ import NewBudget from '@/dialogs/NewBudget.vue';
export default {
props: ["budgetid"],
mounted() {
//this.$store.dispatch("fetchDashboard");
},
watch: {
budgetid () {
this.$store.dispatch("setCurrentBudget", this.budgetid)
}
},
components: { NewBudget }
}
</script>