Feat: Configuración y Administración de Tipos
This commit is contained in:
23
frontend/admin-panel/src/services/productTypeService.ts
Normal file
23
frontend/admin-panel/src/services/productTypeService.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import api from './api';
|
||||
import type { ProductType } from '../types/Product';
|
||||
|
||||
export const productTypeService = {
|
||||
getAll: async (): Promise<ProductType[]> => {
|
||||
const res = await api.get('/producttypes');
|
||||
return res.data;
|
||||
},
|
||||
getById: async (id: number): Promise<ProductType> => {
|
||||
const res = await api.get(`/producttypes/${id}`);
|
||||
return res.data;
|
||||
},
|
||||
create: async (data: Partial<ProductType>): Promise<ProductType> => {
|
||||
const res = await api.post('/producttypes', data);
|
||||
return res.data;
|
||||
},
|
||||
update: async (id: number, data: Partial<ProductType>): Promise<void> => {
|
||||
await api.put(`/producttypes/${id}`, data);
|
||||
},
|
||||
delete: async (id: number): Promise<void> => {
|
||||
await api.delete(`/producttypes/${id}`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user