dev work
This commit is contained in:
parent
6e7977997e
commit
79c783c8c1
20 changed files with 279 additions and 196 deletions
|
|
@ -10,8 +10,21 @@ export const POST: APIRoute = async (context) => {
|
|||
);
|
||||
}
|
||||
|
||||
const { token, solutions } = await context.request.json();
|
||||
if (!token || !solutions) {
|
||||
let body: { token?: unknown; solutions?: unknown };
|
||||
try {
|
||||
body = await context.request.json();
|
||||
} catch {
|
||||
return new Response(JSON.stringify({ success: false }), { status: 400 });
|
||||
}
|
||||
|
||||
const { token, solutions } = body ?? {};
|
||||
if (
|
||||
typeof token !== "string" ||
|
||||
token.length > 256 ||
|
||||
!Array.isArray(solutions) ||
|
||||
solutions.length > 128 ||
|
||||
!solutions.every((s) => typeof s === "number")
|
||||
) {
|
||||
return new Response(JSON.stringify({ success: false }), { status: 400 });
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue