import Breadcrumb from "@/app/components/Breadcrumb"; import NewsSection from "@/app/blog/components/NewsSection"; import Sidebar from "@/app/blog/components/Sidebar"; import { fetchBlogsByCategory, fetchCategoryDetail } from "@/api/blog"; interface CategoryPageProps { params: Promise<{ slug: string; }> | { slug: string; }; } export default async function CategoryPage({ params }: CategoryPageProps) { // Handle both Promise and direct object const resolvedParams = params instanceof Promise ? await params : params; const slug = resolvedParams.slug; // Fetch category detail and blogs let categoryResponse, blogsResponse; try { [categoryResponse, blogsResponse] = await Promise.all([ fetchCategoryDetail(slug), fetchBlogsByCategory(slug, { page: 1, limit: 10 }), ]); } catch { return ( <> Category not found The category you are looking for does not exist. > ); } const category = categoryResponse.data; const blogs = blogsResponse.data.blogs; return ( <> > ); }
The category you are looking for does not exist.