fix(ssr): only use 1 network request to fetch map ids
All checks were successful
deploy / deploy (push) Successful in 58s

This commit is contained in:
Lee
2023-11-08 22:24:38 +00:00
parent 3dd2fc48ad
commit af707a8c79
2 changed files with 26 additions and 21 deletions

View File

@ -19,14 +19,15 @@ export async function GET(request: Request) {
const map = await BeatsaverAPI.fetchMapByHash(mapHash);
if (map) {
maps[mapHash] = map;
mapCache.set(mapHash, map);
}
if (map && idOnly) {
maps[mapHash] = { id: map.id };
}
}
return new Response(JSON.stringify(maps), {
headers: { "content-type": "application/json;charset=UTF-8" },
});
}
return new Response(JSON.stringify(maps), {
headers: { "content-type": "application/json;charset=UTF-8" },
});
}