feat(categories): add create, update, and delete methods to category service

- Introduced `create`, `update`, and `remove` methods for managing categories via the service.
- Enables API integration for category CRUD functionality.
This commit is contained in:
Mathis HERRIOT
2026-01-21 13:20:16 +01:00
parent 9b714716f6
commit c8820a71b6

View File

@@ -11,4 +11,18 @@ export const CategoryService = {
const { data } = await api.get<Category>(`/categories/${id}`);
return data;
},
async create(category: Partial<Category>): Promise<Category> {
const { data } = await api.post<Category>("/categories", category);
return data;
},
async update(id: string, category: Partial<Category>): Promise<Category> {
const { data } = await api.patch<Category>(`/categories/${id}`, category);
return data;
},
async remove(id: string): Promise<void> {
await api.delete(`/categories/${id}`);
},
};