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