Add save-data endpoint for user history

This commit is contained in:
Regalijan 2024-04-03 14:14:11 -04:00
parent 7561c1fefe
commit 0f1e5c510f
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View 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);
}
}