Implement Budget-List via Getter
This commit is contained in:
parent
6086447126
commit
0bd63636bb
@ -1,10 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
|
||||||
dashboard () {
|
|
||||||
return this.$store.state;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted () {
|
mounted () {
|
||||||
this.$store.dispatch("fetchDashboard");
|
this.$store.dispatch("fetchDashboard");
|
||||||
}
|
}
|
||||||
@ -12,7 +7,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="dashboard != nil" v-for="budget in dashboard.Budgets" class="budget-item">
|
<div v-for="budget in $store.getters.Budgets" class="budget-item">
|
||||||
<router-link v-bind:to="'/budget/'+budget.ID">{{budget.Name}}</router-link>
|
<router-link v-bind:to="'/budget/'+budget.ID">{{budget.Name}}</router-link>
|
||||||
<span class="time"></span>
|
<span class="time"></span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,6 +10,11 @@ const dashboard = {
|
|||||||
state.Budgets = budgets;
|
state.Budgets = budgets;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getters: {
|
||||||
|
Budgets(state) {
|
||||||
|
return state.Budgets || [];
|
||||||
|
}
|
||||||
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchDashboard ({state, commit, rootState}) {
|
fetchDashboard ({state, commit, rootState}) {
|
||||||
fetch("/api/v1/dashboard", {
|
fetch("/api/v1/dashboard", {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user