Fase 2: Gestión de Atributos Dinámicos (Back & Front EAV Definition)
This commit is contained in:
18
frontend/admin-panel/src/services/attributeService.ts
Normal file
18
frontend/admin-panel/src/services/attributeService.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import api from './api';
|
||||
import { AttributeDefinition } from '../types/AttributeDefinition';
|
||||
|
||||
export const attributeService = {
|
||||
getByCategoryId: async (categoryId: number): Promise<AttributeDefinition[]> => {
|
||||
const response = await api.get<AttributeDefinition[]>(`/attributedefinitions/category/${categoryId}`);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
create: async (attribute: Partial<AttributeDefinition>): Promise<AttributeDefinition> => {
|
||||
const response = await api.post<AttributeDefinition>('/attributedefinitions', attribute);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
delete: async (id: number): Promise<void> => {
|
||||
await api.delete(`/attributedefinitions/${id}`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user