enzostvs's picture
enzostvs HF staff
load data client side
3b75cc4
raw
history blame
590 Bytes
import { modelStore } from "$lib/stores/use-model";
/** @type {import('./$types').PageServerLoad} */
export async function load({ fetch, url }) {
const model_param = url.searchParams.get("model")
if (model_param) {
const model_request = await fetch(`/api/models/${model_param?.replace("/", "@")}?full=true`, {
method: "GET",
headers: {
"Content-Type": "application/json"
}
})
const data = await model_request?.clone().json().catch(() => null);
modelStore.set({
model: data?.model ?? null,
open: true
});
}
return {
}
}