init
This commit is contained in:
27
src/services/budgetsService.ts
Normal file
27
src/services/budgetsService.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import apiClient from '@/plugins/axios';
|
||||
import {BudgetCategory} from "@/models/Budget";
|
||||
// Импортируете настроенный экземпляр axios
|
||||
|
||||
export const getBudgetInfo = async (budget_id: number) => {
|
||||
console.log('getBudgetInfo');
|
||||
let budgetInfo = await apiClient.get('/budgets/' + budget_id);
|
||||
budgetInfo = budgetInfo.data;
|
||||
|
||||
budgetInfo.plannedExpenses.forEach(e => {
|
||||
e.date = new Date(e.date)
|
||||
})
|
||||
|
||||
budgetInfo.plannedIncomes.forEach(e => {
|
||||
e.date = new Date(e.date)
|
||||
})
|
||||
|
||||
budgetInfo.transactions.forEach(e => {
|
||||
e.date = new Date(e.date)
|
||||
})
|
||||
return budgetInfo
|
||||
|
||||
};
|
||||
|
||||
export const updateBudgetCategoryRequest = async (budget_id, category: BudgetCategory) => {
|
||||
await apiClient.put('/budgets/' + budget_id + '/category', category);
|
||||
}
|
||||
Reference in New Issue
Block a user