Files
sexy/packages/frontend/src/routes/admin/articles/[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

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