Fixed a few bugs
This commit is contained in:
@@ -48,15 +48,15 @@ export async function POST(req: NextRequest) {
|
|||||||
if (!session)
|
if (!session)
|
||||||
return NextResponse.json({ error: "Invalid session" }, { status: 401 });
|
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(
|
return NextResponse.json(
|
||||||
{ error: "Run is not live or does not exist" },
|
{ error: "Run is not live or does not exist" },
|
||||||
{ status: 401 },
|
{ 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 });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export async function getLiveRunMoves(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function addRun(run: LiveRun) {
|
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";
|
throw "Duplicate run";
|
||||||
|
|
||||||
liveRuns.push(run);
|
liveRuns.push(run);
|
||||||
|
|||||||
Reference in New Issue
Block a user