Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
import { error } from '@sveltejs/kit'; | |
/** @type {import('./$types').PageLoad} */ | |
export async function load({ params, fetch }) { | |
const { userId, slug } = params; | |
const model_request = await fetch(`/api/models/${userId + "@" + slug}?full=true&metadata=true`, { | |
method: "GET", | |
headers: { | |
"Content-Type": "application/json" | |
} | |
}) | |
const data = await model_request?.clone().json().catch(() => null); | |
if (!data?.model) { | |
return error(404, 'Not found'); | |
} | |
return data | |
} |