fixes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import apiClient from '@/services/axiosSetup';
|
||||
import {Budget, BudgetCategory} from "@/models/Budget";
|
||||
import {format} from "date-fns";
|
||||
// Импортируете настроенный экземпляр axios
|
||||
|
||||
export const getBudgetInfos = async () => {
|
||||
@@ -31,7 +32,7 @@ export const getBudgetTransactions = async (budgetId, transactionType, categoryT
|
||||
url += '?type=' + transactionType
|
||||
}
|
||||
if (transactionType && categoryType) {
|
||||
url += '/'+transactionType+'/'+categoryType
|
||||
url += '/' + transactionType + '/' + categoryType
|
||||
}
|
||||
// if (!categoryType) {
|
||||
// throw new Error('No CategoryType');
|
||||
@@ -67,4 +68,16 @@ export const getBudgetInfo = async (budget_id: number) => {
|
||||
|
||||
export const updateBudgetCategoryRequest = async (budget_id, category: BudgetCategory) => {
|
||||
await apiClient.put('/budgets/' + budget_id + '/category', category);
|
||||
}
|
||||
|
||||
export const createBudget = async (budget: Budget, createRecurrent: Boolean) => {
|
||||
budget.dateFrom = format(budget.dateFrom, 'yyyy-MM-dd')
|
||||
budget.dateTo = format(budget.dateTo, 'yyyy-MM-dd')
|
||||
let data = {
|
||||
budget: budget,
|
||||
createRecurrent: createRecurrent
|
||||
}
|
||||
await apiClient.post('/budgets', data);
|
||||
budget.dateFrom = format(budget.dateFrom, 'dd.mm.yy')
|
||||
budget.dateTo = format(budget.dateTo, 'dd.mm.yy')
|
||||
}
|
||||
Reference in New Issue
Block a user