Do not use a store for API
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { defineStore } from "pinia"
|
||||
import { useAPI } from "./api";
|
||||
import { GET } from "../api";
|
||||
import { useSessionStore } from "./session";
|
||||
|
||||
interface State {
|
||||
@ -81,14 +81,12 @@ export const useAccountStore = defineStore("budget/account", {
|
||||
await this.FetchAccount(accountid);
|
||||
},
|
||||
async FetchAccount(accountid : string) {
|
||||
const api = useAPI();
|
||||
const result = await api.GET("/account/" + accountid + "/transactions");
|
||||
const result = await GET("/account/" + accountid + "/transactions");
|
||||
const response = await result.json();
|
||||
this.Transactions = response.Transactions;
|
||||
},
|
||||
async FetchMonthBudget(budgetid : string, year : number, month : number) {
|
||||
const api = useAPI();
|
||||
const result = await api.GET("/budget/" + budgetid + "/" + year + "/" + month);
|
||||
const result = await GET("/budget/" + budgetid + "/" + year + "/" + month);
|
||||
const response = await result.json();
|
||||
this.addCategoriesForMonth(year, month, response.Categories);
|
||||
},
|
||||
|
Reference in New Issue
Block a user