Added auth to server hook.

This commit is contained in:
2025-01-23 20:58:46 -08:00
parent 8700c431cf
commit 5487a23c86
24 changed files with 1305 additions and 55 deletions

View File

@ -1,10 +1,15 @@
import { games } from "$lib/server/cache";
import { notFoundResponse, singleResponse } from "$lib/server/responseBodies";
import { badRequestResponse, notFoundResponse, singleResponse } from "$lib/server/responseBodies";
import type { RequestHandler } from "@sveltejs/kit";
export const GET: RequestHandler = ({ params }): Response => {
const id = params["gameid"];
const game = games.find(({ id: gid }) => id === gid);
if (!id) {
return badRequestResponse("missing gameid parameter");
}
const game = games.find(({ id: gid }) => id === gid.toString());
if (!game) {
return notFoundResponse();