fix spaces
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import apiClient from '@/services/axiosSetup';
|
||||
import {Budget, BudgetCategory} from "@/models/Budget";
|
||||
import {format} from "date-fns";
|
||||
import {useSpaceStore} from "@/stores/spaceStore";
|
||||
// Импортируете настроенный экземпляр axios
|
||||
|
||||
export const getBudgetInfos = async () => {
|
||||
@@ -62,8 +63,8 @@ export const getBudgetCategoriesSums = async (budgetId) => {
|
||||
}
|
||||
|
||||
export const getBudgetInfo = async (budget_id: string) => {
|
||||
|
||||
let budgetInfo = await apiClient.get('/budgets/' + budget_id);
|
||||
const spaceStore = useSpaceStore()
|
||||
let budgetInfo = await apiClient.get(`/spaces/${spaceStore.space?.id}/budgets/${budget_id}`);
|
||||
budgetInfo = budgetInfo.data;
|
||||
|
||||
budgetInfo.dateFrom = new Date(budgetInfo.dateFrom)
|
||||
@@ -87,7 +88,8 @@ export const hideWarnRequest = async (budgetId: string, warnId: string) => {
|
||||
}
|
||||
|
||||
export const updateBudgetCategoryRequest = async (budget_id, category: BudgetCategory) => {
|
||||
return await apiClient.post('/budgets/' + budget_id + '/categories/' + category.category.id + "/limit", {"limit": category.currentLimit}).then(i => i.data);
|
||||
const spaceStore = useSpaceStore()
|
||||
return await apiClient.post(`/spaces/${spaceStore.space?.id}/budgets/${budget_id}/categories/${category.category.id}/limit`, {"limit": category.currentLimit}).then(i => i.data);
|
||||
}
|
||||
|
||||
export const createBudget = async (budget: Budget, createRecurrent: Boolean) => {
|
||||
@@ -113,7 +115,8 @@ export const createBudget = async (budget: Budget, createRecurrent: Boolean) =>
|
||||
export const deleteBudgetRequest = async (budgetId: string) => {
|
||||
try {
|
||||
// throw Error("test")
|
||||
let response = await apiClient.delete(`/budgets/${budgetId}`);
|
||||
const spaceStore = useSpaceStore()
|
||||
let response = await apiClient.delete(`/spaces/${spaceStore.space?.id}/budgets/${budgetId}`);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user