import "server-only"; import { notFound } from "next/navigation"; import { api, ApiError, unwrap, type ProductPage } from "@/lib/api"; /** The product, or not found (also when it's adult and the visitor can't see adult products). */ export async function loadProduct(id: string): Promise { if (!/^[a-z2-7]{10}$/.test(id)) notFound(); try { return unwrap(await api.products({ id }).get()); } catch (e) { if (e instanceof ApiError && e.status === 404) notFound(); throw e; } }