From 9e892f6ed13cdab3fbd8aca001806c5a70f11325 Mon Sep 17 00:00:00 2001 From: kyuuseiryuu Date: Tue, 3 Mar 2026 00:58:58 +0900 Subject: [PATCH] refactor(api): switch nowScores endpoint from GET query to POST JSON body - send uids as JSON payload in frontend event loader - update /api/user/nowScores route to accept POST and parse req.json() - keep score lookup behavior unchanged --- src/frontend.tsx | 6 +++++- src/index.tsx | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/frontend.tsx b/src/frontend.tsx index e8ba087..90fe487 100644 --- a/src/frontend.tsx +++ b/src/frontend.tsx @@ -48,7 +48,11 @@ const route = createBrowserRouter([ score: e.score, realname: e.name, } as XCXMember)); - const uidScore = await fetch(`/api/user/nowScores?uids=${info.players.map(e => e.uid).join(',')}`); + const uids = info.players.map(e => e.uid); + const uidScore = await fetch(`/api/user/nowScores`, { + method: "POST", + body: JSON.stringify({ uids }), + }); return { info, members, uidScore: new Map(Object.entries(await uidScore.json())) }; }, Component: EventPage, diff --git a/src/index.tsx b/src/index.tsx index 5b04488..59af538 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -43,9 +43,8 @@ const server = serve({ } }, "/api/user/nowScores": { - async GET(req) { - const searchParams = new URL(req.url).searchParams; - const uids = searchParams.get('uids')?.split(',') ?? []; + async POST(req) { + const { uids } = await req.json(); const uidScore = await getUidScore(uids); return Response.json(uidScore); }