Files
sexy/packages/frontend/src/routes/admin/videos/[id]/+page.server.ts
Sebastian Krüger bff354094e
Some checks failed
Build and Push Backend Image / build (push) Successful in 43s
Build and Push Frontend Image / build (push) Has been cancelled
fix: add adminGetVideo/adminGetArticle queries to fix 404 on edit pages
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>
2026-03-07 11:05:21 +01:00

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 };
}