import { getCollection } from '$lib/utils/payload'
import type { PageLoad } from './$types'

export const load: PageLoad = async ({ fetch }) => {
    const { docs: artikel } = await getCollection('artikel', {
        sort: '-publishedAt',
        where: { _status: { equals: 'published' } },
        select: {
            title: true,
            slug: true,
            excerpt: true,
            publishedAt: true,
            featuredImage: true,
        },
    }, fetch)

    return { artikel }
}