Fix params/searchParams types for Next.js app router
This commit is contained in:
@@ -6,7 +6,7 @@ import Footer from "@/components/marketing/Footer";
|
||||
import ScrollReveal from "@/components/animations/ScrollReveal";
|
||||
import { getBlogPost, getBlogPosts, getSiteConfig } from "@/lib/content";
|
||||
|
||||
type Props = { params: { slug: string } };
|
||||
type Props = { params: Promise<{ slug: string }> };
|
||||
|
||||
// Corps des articles — FUTURE: champ rich text Payload CMS
|
||||
const articleContenu: Record<string, string[]> = {
|
||||
@@ -69,7 +69,7 @@ export async function generateStaticParams() {
|
||||
export async function generateMetadata(
|
||||
{ params }: Props
|
||||
): Promise<Metadata> {
|
||||
const { slug } = params;
|
||||
const { slug } = await params;
|
||||
const [post, config] = await Promise.all([getBlogPost(slug), getSiteConfig()]);
|
||||
if (!post) return { title: "Article introuvable" };
|
||||
return {
|
||||
@@ -80,7 +80,7 @@ export async function generateMetadata(
|
||||
}
|
||||
|
||||
export default async function BlogArticlePage({ params }: Props) {
|
||||
const { slug } = params;
|
||||
const { slug } = await params;
|
||||
const post = await getBlogPost(slug);
|
||||
if (!post) notFound();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user