From 80336104bccaa608e474f3b667ba94ea6a084ac4 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Sun, 8 Feb 2026 14:04:11 +0100 Subject: [PATCH] Fixed a few bugs --- src/app/api/run/route.ts | 8 ++++---- src/modules/live-run/core.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/api/run/route.ts b/src/app/api/run/route.ts index 50acf2f..e2a618d 100644 --- a/src/app/api/run/route.ts +++ b/src/app/api/run/route.ts @@ -48,15 +48,15 @@ export async function POST(req: NextRequest) { if (!session) return NextResponse.json({ error: "Invalid session" }, { status: 401 }); - const run = await Core.getLiveRun(runId); + const liveRun = await Core.getLiveRun(runId); - if (!run) + if (!liveRun) return NextResponse.json( { error: "Run is not live or does not exist" }, { status: 401 }, ); - await Core.submitRun(supabase, run, session[0].id); + const run = await Core.submitRun(supabase, liveRun, session[0].id); - return NextResponse.json({ ok: true, runId }); + return NextResponse.json({ ok: true, run }); } diff --git a/src/modules/live-run/core.ts b/src/modules/live-run/core.ts index 01ca5bb..318cfc7 100644 --- a/src/modules/live-run/core.ts +++ b/src/modules/live-run/core.ts @@ -22,7 +22,7 @@ export async function getLiveRunMoves( } export async function addRun(run: LiveRun) { - if (!liveRuns.find((r) => r.id === run.id || r.username === run.username)) + if (liveRuns.find((r) => r.id === run.id || r.username === run.username)) throw "Duplicate run"; liveRuns.push(run);