From 68e44fafc75aa9447901f729a7e83956e48e6e33 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Fri, 9 Aug 2024 13:36:28 +0200 Subject: [PATCH] Fix vulnerability deletion API. --- app/api/delete/vulnerability/[id]/route.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/delete/vulnerability/[id]/route.ts b/app/api/delete/vulnerability/[id]/route.ts index 3e1d4cc..bad8fa6 100644 --- a/app/api/delete/vulnerability/[id]/route.ts +++ b/app/api/delete/vulnerability/[id]/route.ts @@ -6,8 +6,6 @@ export async function DELETE( request: Request, { params }: { params: { id: string } } ) { - const client = await clientPromise; - const db = client.db(); const { id } = params; if (!id) { @@ -15,6 +13,8 @@ export async function DELETE( } try { + const client = await clientPromise; + const db = client.db("downloadsDatabase"); const result = await db .collection("vulnerabilities") .deleteOne({ _id: new ObjectId(id) });