Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add save-data endpoint for user history
  • Loading branch information
regalijan committed Apr 3, 2024
1 parent 7561c1f commit 0f1e5c5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions functions/api/game-bans/[user]/save-data.ts
@@ -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);
}
}

0 comments on commit 0f1e5c5

Please sign in to comment.