clean code

pr/2623
CarinaWolli 2022-04-26 13:30:04 +02:00
parent 831c85dfef
commit 86cbdb2664
1 changed files with 5 additions and 3 deletions

View File

@ -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,
},
});
}