This commit is contained in:
Vladimir Voronin
2024-10-24 17:32:14 +03:00
parent 41a6a15936
commit c5257376a3
52 changed files with 19652 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
// src/services/categoryService.ts
import apiClient from '@/plugins/axios';
import {Category} from "@/models/Category"; // Импортируете настроенный экземпляр axios
export const getCategories = async (type = null) => {
type = type ? type : ''
return await apiClient.get('/categories/?type=' + type);
};
export const getCategoryTypes = async () => {
return await apiClient.get('/categories/types/');
}
export const createCategory = async (category: Category) => {
return await apiClient.post('/categories', category);
};
export const updateCategory = async (id: number, category: any) => {
return await apiClient.put(`/categories/${id}`, category);
};
export const deleteCategory = async (id: number) => {
return await apiClient.delete(`/categories/${id}`);
};