add spaces
This commit is contained in:
@@ -5,9 +5,8 @@ import {format} from "date-fns";
|
||||
|
||||
export const getBudgetInfos = async () => {
|
||||
try {
|
||||
|
||||
|
||||
let response = await apiClient.get('/budgets');
|
||||
let spaceId = localStorage.getItem("spaceId")
|
||||
let response = await apiClient.get(`/spaces/${spaceId}/budgets`);
|
||||
let budgetInfos = response.data;
|
||||
budgetInfos.forEach((budgetInfo: Budget) => {
|
||||
budgetInfo.dateFrom = new Date(budgetInfo.dateFrom);
|
||||
@@ -94,7 +93,7 @@ export const updateBudgetCategoryRequest = async (budget_id, category: BudgetCat
|
||||
export const createBudget = async (budget: Budget, createRecurrent: Boolean) => {
|
||||
|
||||
try {
|
||||
|
||||
let spaceId = localStorage.getItem("spaceId")
|
||||
let budgetToCreate = JSON.parse(JSON.stringify(budget));
|
||||
budgetToCreate.dateFrom = format(budget.dateFrom, 'yyyy-MM-dd')
|
||||
budgetToCreate.dateTo = format(budget.dateTo, 'yyyy-MM-dd')
|
||||
@@ -102,7 +101,7 @@ export const createBudget = async (budget: Budget, createRecurrent: Boolean) =>
|
||||
budget: budgetToCreate,
|
||||
createRecurrent: createRecurrent
|
||||
}
|
||||
await apiClient.post('/budgets/', data);
|
||||
await apiClient.post(`/spaces/${spaceId}/budgets`, data);
|
||||
|
||||
} catch (e){
|
||||
console.error(e)
|
||||
|
||||
Reference in New Issue
Block a user