Add type-information to GetBudgeted
This commit is contained in:
@ -39,6 +39,12 @@ export interface Category {
|
||||
Activity: number;
|
||||
}
|
||||
|
||||
interface BudgetedAmounts {
|
||||
Assigned: number,
|
||||
Deassigned: number,
|
||||
Activity: number,
|
||||
}
|
||||
|
||||
export const useAccountStore = defineStore("budget/account", {
|
||||
state: (): State => ({
|
||||
Accounts: new Map<string, Account>(),
|
||||
@ -71,9 +77,9 @@ export const useAccountStore = defineStore("budget/account", {
|
||||
return budget.CurrentBudget?.IncomeCategoryID;
|
||||
},
|
||||
GetBudgeted(state) {
|
||||
return (year: number, month: number) => {
|
||||
return (year: number, month: number) : BudgetedAmounts => {
|
||||
const IncomeCategoryID = this.GetIncomeCategoryID;
|
||||
if (IncomeCategoryID == null) return 0;
|
||||
if (IncomeCategoryID == null) return {Activity: 0, Assigned: 0, Deassigned: 0};
|
||||
|
||||
const categories = this.AllCategoriesForMonth(year, month);
|
||||
|
||||
@ -90,9 +96,9 @@ export const useAccountStore = defineStore("budget/account", {
|
||||
deassigned += category.Assigned;
|
||||
}
|
||||
return {
|
||||
assigned,
|
||||
deassigned,
|
||||
activity
|
||||
Assigned: assigned,
|
||||
Deassigned: deassigned,
|
||||
Activity: activity
|
||||
};
|
||||
};
|
||||
},
|
||||
|
Reference in New Issue
Block a user