23 lines
631 B
TypeScript
23 lines
631 B
TypeScript
'use client';
|
|
import { useParams } from 'next/navigation';
|
|
import CategoryPage from '@/components/Product/Category';
|
|
import ProductDetailPage from '@/components/Product/ProductDetail';
|
|
|
|
import { resolvePageType } from '@/lib/resolvePageType';
|
|
|
|
export default function DynamicPage() {
|
|
const { slug } = useParams();
|
|
const fullSlug = '/' + slug;
|
|
|
|
const pageType = resolvePageType(fullSlug);
|
|
|
|
switch (pageType) {
|
|
case 'category':
|
|
return <CategoryPage slug={fullSlug} />;
|
|
case 'product-detail':
|
|
return <ProductDetailPage slug={fullSlug} />;
|
|
default:
|
|
return <div>404 Không tìm thấy</div>;
|
|
}
|
|
}
|