import Link from 'next/link'; import { getPreview } from '@/lib/preview'; import config from '@payload-config'; import { getPayload } from 'payload'; export default async function Page() { const { isPreview, where } = await getPreview(); const payload = await getPayload({ config }); const posts = await payload.find({ collection: 'posts', where, draft: isPreview }); return (
{posts.docs.map((post) => ( {post.title} ))}
); }