Extract GetAccount
This commit is contained in:
parent
bbb12a788d
commit
b3b878854e
@ -90,11 +90,16 @@ export const useAccountStore = defineStore("budget/account", {
|
|||||||
return categories.filter(x => x.Group == group);
|
return categories.filter(x => x.Group == group);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
GetAccount(state) {
|
||||||
|
return (accountid: string) => {
|
||||||
|
return this.Accounts.get(accountid);
|
||||||
|
}
|
||||||
|
},
|
||||||
CurrentAccount(state): Account | undefined {
|
CurrentAccount(state): Account | undefined {
|
||||||
if (state.CurrentAccountID == null)
|
if (state.CurrentAccountID == null)
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
||||||
return state.Accounts.get(state.CurrentAccountID);
|
return this.GetAccount(state.CurrentAccountID);
|
||||||
},
|
},
|
||||||
ReconcilingBalance(state): number {
|
ReconcilingBalance(state): number {
|
||||||
let reconciledBalance = this.CurrentAccount!.ReconciledBalance;
|
let reconciledBalance = this.CurrentAccount!.ReconciledBalance;
|
||||||
@ -128,10 +133,7 @@ export const useAccountStore = defineStore("budget/account", {
|
|||||||
return
|
return
|
||||||
|
|
||||||
this.CurrentAccountID = accountid;
|
this.CurrentAccountID = accountid;
|
||||||
const account = this.CurrentAccount;
|
const account = this.GetAccount(accountid)!;
|
||||||
if (account == undefined)
|
|
||||||
return
|
|
||||||
|
|
||||||
useSessionStore().setTitle(account.Name);
|
useSessionStore().setTitle(account.Name);
|
||||||
await this.FetchAccount(account);
|
await this.FetchAccount(account);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user