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>
15 lines
495 B
TypeScript
15 lines
495 B
TypeScript
import { adminGetVideo, getModels } from "$lib/services";
|
|
import { error } from "@sveltejs/kit";
|
|
|
|
export async function load({ params, fetch, cookies }) {
|
|
const token = cookies.get("session_token") || "";
|
|
const [video, modelsResult] = await Promise.all([
|
|
adminGetVideo(params.id, fetch, token).catch(() => null),
|
|
getModels({}, fetch).catch(() => ({ items: [], total: 0 })),
|
|
]);
|
|
|
|
if (!video) throw error(404, "Video not found");
|
|
|
|
return { video, models: modelsResult.items };
|
|
}
|