From 86cbdb2664c9c52e3d5419d9a44c6dc803e95072 Mon Sep 17 00:00:00 2001 From: CarinaWolli Date: Tue, 26 Apr 2022 13:30:04 +0200 Subject: [PATCH] clean code --- apps/web/pages/api/integrations.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/web/pages/api/integrations.ts b/apps/web/pages/api/integrations.ts index 28a3d81487..866d600be6 100644 --- a/apps/web/pages/api/integrations.ts +++ b/apps/web/pages/api/integrations.ts @@ -1,6 +1,8 @@ import { ApiKeyType } from "@prisma/client"; import type { NextApiRequest, NextApiResponse } from "next"; +import _metadata from "@calcom/app-store/zapierother/_metadata"; + import { getSession } from "@lib/auth"; import prisma from "@lib/prisma"; @@ -52,8 +54,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) }, }); - if (integration?.type === "zapier_other") { - const keyToDelete = await prisma.apiKey.findFirst({ + if (integration?.type === _metadata.type) { + const apiKeyToDelete = await prisma.apiKey.findFirst({ where: { userId: session?.user?.id, apiKeyType: ApiKeyType.ZAPIER, @@ -62,7 +64,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) await prisma.apiKey.delete({ where: { - id: keyToDelete?.id, + id: apiKeyToDelete?.id, }, }); }