Switch all db storage to session storage
All checks were successful
Build And Deploy / build-and-deploy (push) Successful in 1m27s
All checks were successful
Build And Deploy / build-and-deploy (push) Successful in 1m27s
Only affects CapAdapter, challenge.ts, and redeem.ts.
This commit is contained in:
parent
1fbcbf772a
commit
6c56b203d3
4 changed files with 56 additions and 87 deletions
|
|
@ -1,12 +1,21 @@
|
|||
import type { APIRoute } from "astro";
|
||||
import cap from "@lib/CapAdapter";
|
||||
import { createCap } from "@lib/CapAdapter";
|
||||
export const prerender = false;
|
||||
|
||||
export const POST: APIRoute = async ({ request }) => {
|
||||
const { token, solutions } = await request.json();
|
||||
export const POST: APIRoute = async (context) => {
|
||||
if (!context.session) {
|
||||
return new Response(
|
||||
JSON.stringify({ success: false, error: "Session unavailable." }),
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
|
||||
const { token, solutions } = await context.request.json();
|
||||
if (!token || !solutions) {
|
||||
return new Response(JSON.stringify({ success: false }), { status: 400 });
|
||||
}
|
||||
|
||||
const cap = createCap(context.session);
|
||||
return new Response(
|
||||
JSON.stringify(await cap.redeemChallenge({ token, solutions })),
|
||||
{ status: 200 },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue