Files
neo-blog/web/src/app/(main)/p/[id]/page.tsx

21 lines
621 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { getPostById } from '@/api/post'
import { cookies } from 'next/headers'
import BlogPost from '@/components/blog-post/blog-post'
// 这个是approuter固定的传入格式无法更改
interface PostPageProps {
params: { id: string }
}
export default async function PostPage({ params }: PostPageProps) {
const cookieStore = await cookies();
const { id } = params;
const post = await getPostById({id, token: cookieStore.get('token')?.value || ''});
if (!post)
return <div></div>
return (
<div className="flex flex-col h-100vh">
<BlogPost post={post} />
</div>
)
}