feat: Add Docker support and improve API structure
- Introduced Dockerfile and .dockerignore for containerization. - Removed unused API route `src/app/api/hello/route.ts`. - Added new API route for fetching products by category. - Enhanced existing product category API to include descriptions. - Updated product categories data structure to include descriptions. - Improved product fetching logic in the product categories page. - Refactored breadcrumb component for better navigation. - Added new AchievementIconWhite component for UI consistency. - Updated Navbar to use routeFactory for better maintainability. - Enhanced styling in various components for improved responsiveness. - Removed obsolete language switcher component.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { IProductCategoryCardProps } from '@/components/pages/productCategories/productCategoryCard.d';
|
||||
import type { IProductCardProps } from '@/components/pages/products/productCard.d';
|
||||
import api from '@/lib/axios';
|
||||
|
||||
export function getProductCategories() {
|
||||
@@ -9,7 +11,9 @@ export function getProductCategories() {
|
||||
.catch((error) => Promise.reject(error));
|
||||
}
|
||||
|
||||
export function getProductCategoryById(categoryId: string) {
|
||||
export function getProductCategoryById(
|
||||
categoryId: string,
|
||||
): Promise<IProductCategoryCardProps> {
|
||||
return api
|
||||
.get(`/product_categories/${categoryId}`)
|
||||
.then(({ data }) => {
|
||||
@@ -17,3 +21,12 @@ export function getProductCategoryById(categoryId: string) {
|
||||
})
|
||||
.catch((error) => Promise.reject(error));
|
||||
}
|
||||
|
||||
export function getProducts(categoryId: string): Promise<IProductCardProps[]> {
|
||||
return api
|
||||
.get(`/product_categories/${categoryId}/products`)
|
||||
.then(({ data }) => {
|
||||
return Promise.resolve(data.data);
|
||||
})
|
||||
.catch((error) => Promise.reject(error));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user