mirror of
https://github.com/Fayorg/calendrier-avant.git
synced 2026-05-27 17:18:38 +02:00
fix: api route
This commit is contained in:
@@ -11,13 +11,12 @@ export async function POST(req: Request){
|
||||
await prisma.grade.findFirst({where: {key: body.key}}).then(async (grade) => {
|
||||
if (grade) {
|
||||
await prisma.grade.create({data: {test: 1, grade: body.grade, key: body.key}})
|
||||
return new NextResponse(
|
||||
JSON.stringify({message: 'Grade updated', cookie: 'voted=true'}), {status: 200}
|
||||
)
|
||||
return NextResponse.json({message: 'Grade updated', cookie: 'voted=true'}, {status: 200})
|
||||
} else {
|
||||
return new NextResponse(
|
||||
return NextResponse.json(
|
||||
JSON.stringify({message: 'Key not found'}), {status: 404}
|
||||
)
|
||||
}
|
||||
})
|
||||
});
|
||||
return NextResponse.json({message: 'Server error'}, {status: 500})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user