24 lines
758 B
TypeScript
24 lines
758 B
TypeScript
import PreviewBlocks from '@/components/PreviewBlocks'
|
|
import { getCurrentUser } from '@/lib/payload'
|
|
import { COLLECTION_SLUG_PAGE } from '@payload/collections/config'
|
|
import { getDocument } from '@/utils/getDocument'
|
|
import { unstable_noStore as noStore } from 'next/cache'
|
|
import { notFound } from 'next/navigation'
|
|
|
|
const PreviewCatchAllPage = async ({ params }: { params: { path: string[] } }) => {
|
|
noStore()
|
|
const [page] = await Promise.all([
|
|
getCurrentUser(),
|
|
getDocument({
|
|
collection: COLLECTION_SLUG_PAGE,
|
|
path: params.path,
|
|
depth: 3,
|
|
cache: false,
|
|
}),
|
|
])
|
|
if (!page) notFound()
|
|
return <PreviewBlocks initialData={page} locale="" url={process.env.BASE_URL || ''} />
|
|
}
|
|
|
|
export default PreviewCatchAllPage
|