Migrate farther
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { Budget, useSessionStore } from "./session";
|
||||
|
||||
interface State {
|
||||
CurrentBudgetID: string | null,
|
||||
@ -12,5 +13,20 @@ export const useBudgetsStore = defineStore('budget', {
|
||||
setCurrentBudgetID(budgetid : string) {
|
||||
this.CurrentBudgetID = budgetid;
|
||||
},
|
||||
},
|
||||
getters: {
|
||||
CurrentBudget() : Budget | undefined {
|
||||
if (this.CurrentBudgetID == null)
|
||||
return undefined;
|
||||
|
||||
const sessionStore = useSessionStore();
|
||||
return sessionStore.Budgets.get(this.CurrentBudgetID);
|
||||
},
|
||||
CurrentBudgetName(state) : string {
|
||||
return this.CurrentBudget?.Name ?? "";
|
||||
},
|
||||
CurrentBudgetID() : string | undefined {
|
||||
return this.CurrentBudgetID;
|
||||
},
|
||||
}
|
||||
})
|
@ -23,6 +23,11 @@ export const useSessionStore = defineStore('session', {
|
||||
Budgets(): IterableIterator<Budget> {
|
||||
return this.Budgets.values();
|
||||
},
|
||||
AuthHeaders(): Object {
|
||||
return {
|
||||
'Authorization': 'Bearer ' + this.Token
|
||||
}
|
||||
},
|
||||
/*// must define return type because of using `this`
|
||||
fullUserDetails (state): FullUserDetails {
|
||||
// import from other stores
|
||||
|
Reference in New Issue
Block a user