Implement budget display
This commit is contained in:
33
web/src/store/budget/index.js
Normal file
33
web/src/store/budget/index.js
Normal file
@ -0,0 +1,33 @@
|
||||
const budget = {
|
||||
state () {
|
||||
return {
|
||||
Accounts: [],
|
||||
Categories: [],
|
||||
Transactions: [],
|
||||
Assignments: []
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
setAccounts (state, accounts) {
|
||||
state.Accounts = accounts;
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
Accounts(state) {
|
||||
return state.Accounts || [];
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
fetchBudget ({state, commit, rootState}, budgetid) {
|
||||
fetch("/api/v1/budget/" + budgetid, {
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + rootState.Session.Token
|
||||
}
|
||||
})
|
||||
.then(x => x.json())
|
||||
.then(x => commit("setAccounts", x.Accounts));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default budget
|
Reference in New Issue
Block a user