Files
esports/src/routes/api/matches/[id]/lobby/+server.ts
2026-02-28 04:35:21 +01:00

17 lines
461 B
TypeScript

import { json, error } from '@sveltejs/kit';
import { moveToLobby } from '$lib/server/match/engine';
import type { RequestHandler } from './$types';
export const POST: RequestHandler = async ({ params, request, locals }) => {
if (!locals.user) error(401, 'Not logged in');
const body = await request.json().catch(() => ({}));
try {
const m = await moveToLobby(params.id, body.osuLobbyId);
return json(m);
} catch (e) {
error(400, e.message);
}
};