File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 11import prisma from "@/prisma/prismaClient" ;
22import { NextResponse } from "next/server" ;
3+ import { getServerSession } from "next-auth" ;
4+ import { Auth } from "@/app/api/utils/auth" ;
35
46// Gets the whole menu
57export 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}
You can’t perform that action at this time.
0 commit comments