mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-25 18:46:23 +00:00
feat: 更新PostPage组件的参数类型定义,确保params为Promise类型
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 9s
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 9s
This commit is contained in:
@ -3,12 +3,13 @@ import { cookies } from 'next/headers'
|
||||
import BlogPost from '@/components/blog-post/blog-post'
|
||||
|
||||
// 这个是approuter固定的传入格式,无法更改
|
||||
interface PostPageProps {
|
||||
params: { id: string }
|
||||
interface Props {
|
||||
params: Promise<{ id: string }>
|
||||
}
|
||||
export default async function PostPage({ params }: PostPageProps) {
|
||||
|
||||
export default async function PostPage({ params }: Props) {
|
||||
const cookieStore = await cookies();
|
||||
const { id } = params;
|
||||
const { id } = await params;
|
||||
const post = await getPostById({id, token: cookieStore.get('token')?.value || ''});
|
||||
if (!post)
|
||||
return <div>文章不存在</div>
|
||||
|
Reference in New Issue
Block a user