Add save-data endpoint for user history
This commit is contained in:
parent
7561c1fefe
commit
0f1e5c510f
14
functions/api/game-bans/[user]/save-data.ts
Normal file
14
functions/api/game-bans/[user]/save-data.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { jsonError, jsonResponse } from "../../../common.js";
|
||||||
|
import { getSaveData } from "../../../roblox-open-cloud.js";
|
||||||
|
|
||||||
|
export async function onRequestGet(context: RequestContext) {
|
||||||
|
const id = parseInt(context.params.id as string);
|
||||||
|
|
||||||
|
if (isNaN(id)) return jsonError("ID must be a number", 400);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return jsonResponse(JSON.stringify(await getSaveData(context, id)));
|
||||||
|
} catch {
|
||||||
|
return jsonError("Failed to retrieve save data", 500);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user