import { getBySlug } from '$lib/utils/payload'
import { error } from '@sveltejs/kit'
import type { PageLoad } from './$types'

export const load: PageLoad = async ({ fetch, params }) => {
    const artikel = await getBySlug('artikel', params.slug, {
        depth: 2,
    }, fetch)

    if (!artikel) throw error(404)

    return { artikel }
}