add Brand Management
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Product, ProductCreate, Shop, ShopCreate, ShoppingEvent, ShoppingEventCreate } from '../types';
|
||||
import { Product, ProductCreate, Shop, ShopCreate, ShoppingEvent, ShoppingEventCreate, Brand, BrandCreate } from '../types';
|
||||
|
||||
const API_BASE_URL = 'http://localhost:8000';
|
||||
|
||||
@@ -41,6 +41,16 @@ export const shopApi = {
|
||||
delete: (id: number) => api.delete(`/shops/${id}`),
|
||||
};
|
||||
|
||||
// Brand API functions
|
||||
export const brandApi = {
|
||||
getAll: () => api.get<Brand[]>('/brands/'),
|
||||
getById: (id: number) => api.get<Brand>(`/brands/${id}`),
|
||||
create: (brand: BrandCreate) => api.post<Brand>('/brands/', brand),
|
||||
update: (id: number, brand: Partial<BrandCreate>) =>
|
||||
api.put<Brand>(`/brands/${id}`, brand),
|
||||
delete: (id: number) => api.delete(`/brands/${id}`),
|
||||
};
|
||||
|
||||
// Shopping Event API functions
|
||||
export const shoppingEventApi = {
|
||||
getAll: () => api.get<ShoppingEvent[]>('/shopping-events/'),
|
||||
|
||||
Reference in New Issue
Block a user