Skip to content

Commit ec7d5a1

Browse files
committed
wrap missing API return with auth.verify()
1 parent 0887c8e commit ec7d5a1

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

app/api/v2/escape/menu/categories/[categoryId]/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export async function DELETE(
2020
let categoryId = Number(params.categoryId);
2121
// verify productId is an integer
2222
if (isNaN(categoryId) || !categoryId) {
23-
return NextResponse.json({error: "categoryId must be an integer"}, {status: 400});
23+
return auth.verify(NextResponse.json({error: "categoryId must be an integer"}, {status: 400}));
2424
}
2525

2626

app/api/v2/escape/menu/route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import prisma from "@/prisma/prismaClient";
22
import { NextResponse } from "next/server";
3+
import { getServerSession } from "next-auth";
4+
import { Auth } from "@/app/api/utils/auth";
35

46
// Gets the whole menu
57
export async function GET(): Promise<NextResponse> {
8+
const session = getServerSession();
9+
const auth = new Auth(session);
10+
611
let menuCategories = await prisma.menuCategory.findMany(
712
{
813
include: {
@@ -11,5 +16,5 @@ export async function GET(): Promise<NextResponse> {
1116
}
1217
);
1318

14-
return NextResponse.json(menuCategories);
19+
return auth.verify(NextResponse.json(menuCategories));
1520
}

0 commit comments

Comments
 (0)