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

16 lines
496 B
TypeScript
Raw Normal View History

import { adminListVideos, getModels } from "$lib/services";
import { error } from "@sveltejs/kit";
export async function load({ params, fetch, cookies }) {
const token = cookies.get("session_token") || "";
const [allVideos, models] = await Promise.all([
adminListVideos(fetch, token).catch(() => []),
getModels(fetch).catch(() => []),
]);
const video = allVideos.find((v) => v.id === params.id);
if (!video) throw error(404, "Video not found");
return { video, models };
}