Files
sexy/packages/frontend/src/routes/admin/videos/[id]/+page.server.ts

15 lines
495 B
TypeScript
Raw Normal View History

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