Erste brauchbare Version
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user