Files
cms-template/app/(app)/page.tsx
T
2026-08-31 19:55:41 +02:00

29 lines
636 B
TypeScript

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 (
<main className="flex flex-col">
{posts.docs.map((post) => (
<Link
key={post.id}
className="border border-1 border-primary p-4 m-4"
href={`/post/${post.slug}`}
>
{post.title}
</Link>
))}
</main>
);
}