Files
doloro-site-v6/src/routes/store/[slug]/+page.server.ts
T
2026-07-21 12:30:53 +01:00

33 lines
775 B
TypeScript

export const prerender = true;
import { type StoreEntity } from "../+page.server.ts";
export type ProductPageData = {
product: StoreEntity;
slug: string;
url: string;
}
const Catalog: Record<string, StoreEntity> = {};
Catalog["MagicCircle"] = { images: ["MagicCircle"], name: "Magic Circle", description: "Mreowww", short: "magiccircle", category: "Amulets", gumroad: "https://doloro.gumroad.com/l/Amulet", jinxxy: "" }
export function entries() {
return Object.keys(Catalog).map((slug) => ({ slug }));
}
export async function load({ params }: { params: { slug: string } }) {
const slug = params.slug;
const product = Catalog[slug];
if (!product) {
throw new Error(`Product not found: ${slug}`);
}
return {
product,
slug,
url: `/store/${slug}`
};
}