import { adminListArticles, adminListUsers } from "$lib/services"; import { error } from "@sveltejs/kit"; export async function load({ params, fetch, cookies }) { const token = cookies.get("session_token") || ""; const [articles, modelsResult] = await Promise.all([ adminListArticles(fetch, token).catch(() => []), adminListUsers({ role: "model", limit: 200 }, fetch, token).catch(() => ({ items: [], total: 0 })), ]); const article = articles.find((a) => a.id === params.id); if (!article) throw error(404, "Article not found"); return { article, authors: modelsResult.items }; }