Add getters for current budget ID and Name
This commit is contained in:
@ -201,15 +201,27 @@ export const store = createStore<State>({
|
||||
'Authorization': 'Bearer ' + state.Session.Token
|
||||
}
|
||||
},
|
||||
CurrentBudget(state) {
|
||||
CurrentBudget(state) : Budget | undefined {
|
||||
if (state.CurrentBudgetID == null)
|
||||
return {};
|
||||
return undefined;
|
||||
|
||||
return state.Budgets.get(state.CurrentBudgetID) || {};
|
||||
return state.Budgets.get(state.CurrentBudgetID);
|
||||
},
|
||||
CurrentAccount(state) {
|
||||
CurrentBudgetID(state) : string | undefined {
|
||||
return state.CurrentBudgetID;
|
||||
},
|
||||
CurrentBudgetName(state) : string {
|
||||
if (state.CurrentBudgetID == null)
|
||||
return "";
|
||||
|
||||
const currentBudget = state.Budgets.get(state.CurrentBudgetID);
|
||||
if(currentBudget != undefined)
|
||||
return currentBudget.Name;
|
||||
return "";
|
||||
},
|
||||
CurrentAccount(state) : Account | undefined {
|
||||
if (state.CurrentAccountID == null)
|
||||
return { name: "Not found" };
|
||||
return undefined;
|
||||
return state.Accounts.get(state.CurrentAccountID);
|
||||
},
|
||||
OnBudgetAccounts(state) {
|
||||
|
Reference in New Issue
Block a user