update 30/12
This commit is contained in:
@@ -1,43 +1,41 @@
|
||||
// src/app/[slug]/page.tsx
|
||||
import { notFound } from "next/navigation";
|
||||
import { findBySlug } from "@/lib/slugMap";
|
||||
|
||||
import ProductCategory from "@/components/product/Category";
|
||||
import ProductDetail from "@/components/product/ProductDetail";
|
||||
import ArticleHome from "@/components/article/Home";
|
||||
import ArticleCategory from "@/components/article/Category";
|
||||
import ArticleDetail from "@/components/article/ArticleDetail";
|
||||
|
||||
import ArticleHome from "@/components/article/Home";
|
||||
|
||||
export default async function SlugPage({
|
||||
params,
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ slug: string }>;
|
||||
params: { slug: string };
|
||||
}) {
|
||||
const { slug } = await params;
|
||||
|
||||
if (!slug) return notFound();
|
||||
|
||||
const result = findBySlug(slug);
|
||||
|
||||
if (!result) return notFound();
|
||||
|
||||
switch (result.type) {
|
||||
case "product_category":
|
||||
return <ProductCategory slug={slug} />;
|
||||
return <ProductCategory data={result.data} />;
|
||||
|
||||
case "product_detail":
|
||||
return <ProductDetail slug={slug} />;
|
||||
return <ProductDetail data={result.data} />;
|
||||
|
||||
case "article_home":
|
||||
return <ArticleHome slug={slug} />;
|
||||
return <ArticleHome slug={slug} />;
|
||||
|
||||
case "article_category":
|
||||
return <ArticleCategory slug={slug} />;
|
||||
return <ArticleCategory data={result.data} />;
|
||||
|
||||
case "article_detail":
|
||||
return <ArticleDetail slug={slug} />;
|
||||
return <ArticleDetail slug={result.data.slug} />;
|
||||
|
||||
default:
|
||||
return notFound();
|
||||
return notFound();
|
||||
}
|
||||
}
|
||||
|
||||
8
src/app/cart/page.tsx
Normal file
8
src/app/cart/page.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
import CartHome from "@/components/cart/Home";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<CartHome />
|
||||
)
|
||||
}
|
||||
8
src/app/send-cart/page.tsx
Normal file
8
src/app/send-cart/page.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
import SendResult from "@/components/cart/Send";
|
||||
|
||||
export default function SendCartPage() {
|
||||
return (
|
||||
<SendResult />
|
||||
)
|
||||
}
|
||||
8
src/app/tin-tuc/page.tsx
Normal file
8
src/app/tin-tuc/page.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
import ArticleHome from "@/components/article/Home";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<ArticleHome slug="" />
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user