Added auth to server hook.
This commit is contained in:
@ -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();
|
||||
|
Reference in New Issue
Block a user