tobias 9edb207991
Some checks failed
continuous-integration/drone/push Build is failing
Clean up preview pages
2024-07-11 21:04:47 +02:00

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