Fix auth hook so it returns forbidden if the user is authenticated but not allowed to hit an endpoint.

This commit is contained in:
2025-01-29 14:49:53 -08:00
parent 5487a23c86
commit 53214644b4
23 changed files with 835 additions and 187 deletions

View File

@ -5,18 +5,16 @@ import {
badRequestResponse,
forbiddenResponse,
serverErrorResponse,
singleResponse
singleResponse,
} from "$lib/server/responseBodies";
import type { RequestHandler } from "@sveltejs/kit";
export const POST: RequestHandler = async ({ request }): Promise<Response> => {
let body: unknown;
console.log("here");
try {
body = await request.json();
} catch (err) {
console.log(err);
return badRequestResponse("body is required");
}