import { error } from '@sveltejs/kit';
import { getActualites, getActualite } from '$lib/server/actualites';
import type { EntryGenerator } from './$types';

export const entries: EntryGenerator = () => getActualites().map((a) => ({ slug: a.slug }));

export function load({ params }) {
	const article = getActualite(params.slug);
	if (!article) error(404, 'Actualité introuvable');
	return { article };
}
