diff --git a/app/lasers/[id]/page.tsx b/app/lasers/[id]/page.tsx index 739fbe63..dcaccc82 100644 --- a/app/lasers/[id]/page.tsx +++ b/app/lasers/[id]/page.tsx @@ -20,7 +20,7 @@ const FIELD_GROUPS = [ w: "Laser Wattage (W)", mj: "milliJoule Max (mJ)", nm: "Wavelength (nm)", - k_hz: "Pulse Repetition Rate (kHz)", + kHz: "Pulse Repetition Rate (kHz)", // NOTE: schema uses kHz (not k_hz) ns: "Pulse Width (ns)", d: "Beam Diameter (mm)", m2: "M² - Quality", @@ -57,34 +57,26 @@ const FIELD_GROUPS = [ }, ] as const; -const FIELD_KEYS = Array.from( - new Set(["make", "model", ...FIELD_GROUPS.flatMap((g) => Object.keys(g.fields))]) -); - export default async function Page( - { params }: { params: Promise<{ id: string }> } // Next 15: params is a Promise + { params }: { params: Promise<{ id: string }> } // Next 15: params is Promise ) { const { id: submissionId } = await params; - // Next 15: cookies() is async - const jar = await cookies(); + const jar = await cookies(); // Next 15: cookies() is async const token = jar.get("ma_at")?.value; - if (!token) { redirect(`/auth/sign-in?next=${encodeURIComponent(`/lasers/${submissionId}`)}`); } const bearer = `Bearer ${token}`; - const fields = encodeURIComponent(FIELD_KEYS.join(",")); - // Primary key is submission_id + // Pull EVERYTHING the role can see. (No fragile field list.) const res = await dxGET( - `/items/laser_source/${encodeURIComponent(submissionId)}?fields=${fields}`, + `/items/laser_source/${encodeURIComponent(submissionId)}?fields=*`, bearer ); - const row = res?.data ?? res ?? null; + const laser = res?.data ?? res ?? null; + if (!laser) notFound(); - if (!row) notFound(); - - return ; + return ; }