import { readMixSessions, saveMixSession, type MixSpec } from "@/lib/mix"; export const dynamic = "force-dynamic"; // Four numbers per pair of files, remembered. // // Re-deriving a handover by ear is the cost this whole bench exists to remove; // re-deriving it because a tab was closed would be the same cost with none of // the excuse. export async function GET() { return Response.json(await readMixSessions(), { headers: { "cache-control": "no-store" } }); } export async function PUT(request: Request) { let body: Partial; try { body = (await request.json()) as Partial; } catch { return Response.json({ error: "bad json" }, { status: 400 }); } try { return Response.json(await saveMixSession(body)); } catch (err) { return Response.json({ error: String((err as Error)?.message ?? err) }, { status: 400 }); } }