10 lines
345 B
TypeScript
10 lines
345 B
TypeScript
|
|
import { adminListArticles } from "$lib/services";
|
||
|
|
import { error } from "@sveltejs/kit";
|
||
|
|
|
||
|
|
export async function load({ params, fetch }) {
|
||
|
|
const articles = await adminListArticles(fetch).catch(() => []);
|
||
|
|
const article = articles.find((a) => a.id === params.id);
|
||
|
|
if (!article) throw error(404, "Article not found");
|
||
|
|
return { article };
|
||
|
|
}
|