Add persistent match history to server pages
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { serverMatchHistory } from '$lib/server/fleet/match-history.js';
|
||||
|
||||
export function GET({ params, url }: { params: { name: string }; url: URL }) {
|
||||
const limit = Number(url.searchParams.get('limit') ?? 25);
|
||||
if (!Number.isSafeInteger(limit) || limit < 1 || limit > 10000) {
|
||||
return json({ error: 'limit must be between 1 and 10000' }, { status: 400 });
|
||||
}
|
||||
return json(serverMatchHistory(params.name, limit));
|
||||
}
|
||||
Reference in New Issue
Block a user