brands-in-shops feature implemented
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Product, ProductCreate, Shop, ShopCreate, ShoppingEvent, ShoppingEventCreate, Brand, BrandCreate, Grocery, GroceryCreate, GroceryCategory, GroceryCategoryCreate } from '../types';
|
||||
import { Product, ProductCreate, Shop, ShopCreate, ShoppingEvent, ShoppingEventCreate, Brand, BrandCreate, Grocery, GroceryCreate, GroceryCategory, GroceryCategoryCreate, BrandInShop, BrandInShopCreate } from '../types';
|
||||
|
||||
// Use different API URLs based on environment
|
||||
const API_BASE_URL = process.env.NODE_ENV === 'production'
|
||||
@@ -54,6 +54,16 @@ export const brandApi = {
|
||||
delete: (id: number) => api.delete(`/brands/${id}`),
|
||||
};
|
||||
|
||||
// BrandInShop API functions
|
||||
export const brandInShopApi = {
|
||||
getAll: () => api.get<BrandInShop[]>('/brands-in-shops/'),
|
||||
getByShop: (shopId: number) => api.get<BrandInShop[]>(`/brands-in-shops/shop/${shopId}`),
|
||||
getByBrand: (brandId: number) => api.get<BrandInShop[]>(`/brands-in-shops/brand/${brandId}`),
|
||||
getById: (id: number) => api.get<BrandInShop>(`/brands-in-shops/${id}`),
|
||||
create: (brandInShop: BrandInShopCreate) => api.post<BrandInShop>('/brands-in-shops/', brandInShop),
|
||||
delete: (id: number) => api.delete(`/brands-in-shops/${id}`),
|
||||
};
|
||||
|
||||
// Grocery Category API functions
|
||||
export const groceryCategoryApi = {
|
||||
getAll: () => api.get<GroceryCategory[]>('/grocery-categories/'),
|
||||
|
||||
Reference in New Issue
Block a user