feat: add product category components and services
- Implemented ProductCategoryCard component for displaying product categories with icons, titles, and counts. - Created ProductCategoryCardInProducts component for rendering product categories in a product context. - Defined TypeScript interfaces for product category props. - Added ProductCard component for individual product display with image and title. - Established Axios instance for API calls with request and response interceptors. - Developed services for fetching product categories and category details from the API.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import api from '@/lib/axios';
|
||||
|
||||
export function getProductCategories() {
|
||||
return api
|
||||
.get('/product_categories')
|
||||
.then(({ data }) => {
|
||||
return Promise.resolve(data.data);
|
||||
})
|
||||
.catch((error) => Promise.reject(error));
|
||||
}
|
||||
|
||||
export function getProductCategoryById(categoryId: string) {
|
||||
return api
|
||||
.get(`/product_categories/${categoryId}`)
|
||||
.then(({ data }) => {
|
||||
return Promise.resolve(data.data);
|
||||
})
|
||||
.catch((error) => Promise.reject(error));
|
||||
}
|
||||
Reference in New Issue
Block a user