The edit page loaders were calling adminListVideos/adminListArticles with the old pre-pagination signatures and filtering by ID client-side, which broke after pagination limited results to 50. Now fetches the single item by ID directly via new adminGetVideo and adminGetArticle backend queries. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
18 lines
569 B
TypeScript
18 lines
569 B
TypeScript
import { adminGetArticle, adminListUsers } from "$lib/services";
|
|
import { error } from "@sveltejs/kit";
|
|
|
|
export async function load({ params, fetch, cookies }) {
|
|
const token = cookies.get("session_token") || "";
|
|
const [article, modelsResult] = await Promise.all([
|
|
adminGetArticle(params.id, fetch, token).catch(() => null),
|
|
adminListUsers({ role: "model", limit: 200 }, fetch, token).catch(() => ({
|
|
items: [],
|
|
total: 0,
|
|
})),
|
|
]);
|
|
|
|
if (!article) throw error(404, "Article not found");
|
|
|
|
return { article, authors: modelsResult.items };
|
|
}
|