fix(templates): await params/cookies properly (#8560)

This commit is contained in:
Elliot DeNolf
2024-10-04 18:38:27 -07:00
committed by GitHub
parent d564cd44e9
commit 463490f670
3 changed files with 7 additions and 6 deletions

View File

@@ -73,7 +73,8 @@ export default async function Page({ params: paramsPromise }: Args) {
)
}
export async function generateMetadata({ params: { slug = 'home' } }): Promise<Metadata> {
export async function generateMetadata({ params: paramsPromise }): Promise<Metadata> {
const { slug = 'home' } = await paramsPromise
const page = await queryPageBySlug({
slug,
})

View File

@@ -7,12 +7,12 @@ import { RootPage, generatePageMetadata } from '@payloadcms/next/views'
import { importMap } from '../importMap'
type Args = {
params: {
params: Promise<{
segments: string[]
}
searchParams: {
}>
searchParams: Promise<{
[key: string]: string | string[]
}
}>
}
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>

View File

@@ -11,7 +11,7 @@ export const getMeUser = async (args?: {
user: User
}> => {
const { nullUserRedirect, validUserRedirect } = args || {}
const cookieStore = cookies()
const cookieStore = await cookies()
const token = cookieStore.get('payload-token')?.value
const meUserReq = await fetch(`${process.env.NEXT_PUBLIC_SERVER_URL}/api/users/me`, {