From 8b87cde733acef43660e7105e5f67eb4f2d86d20 Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Thu, 16 Jun 2022 01:48:29 +0200 Subject: [PATCH] fix: _delete missing userId rename --- pages/api/users/[userId]/_delete.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/api/users/[userId]/_delete.ts b/pages/api/users/[userId]/_delete.ts index 3478c44789..c2d8d5db29 100644 --- a/pages/api/users/[userId]/_delete.ts +++ b/pages/api/users/[userId]/_delete.ts @@ -38,7 +38,7 @@ export async function deleteHandler(req: NextApiRequest) { if (!isAdmin && query.userId !== req.userId) throw new HttpError({ statusCode: 401, message: "Unauthorized" }); - const user = await prisma.user.findUnique({ where: { id: query.id } }); + const user = await prisma.user.findUnique({ where: { id: query.userId } }); if (!user) throw new HttpError({ statusCode: 404, message: "User not found" }); await prisma.user.delete({ where: { id: user.id } });