fix param name in deleteSubcription
parent
d4bb915cc8
commit
c4bfe98798
|
@ -67,11 +67,11 @@ export async function addSubscription({
|
|||
export async function deleteSubscription({
|
||||
appApiKey,
|
||||
webhookId,
|
||||
appName,
|
||||
appId,
|
||||
}: {
|
||||
appApiKey: ApiKey;
|
||||
webhookId: string;
|
||||
appName: string;
|
||||
appId: string;
|
||||
}) {
|
||||
try {
|
||||
const webhook = await prisma.webhook.findFirst({
|
||||
|
@ -94,7 +94,7 @@ export async function deleteSubscription({
|
|||
});
|
||||
for (const booking of bookingsWithScheduledJobs) {
|
||||
const updatedScheduledJobs = booking.scheduledJobs.filter(
|
||||
(scheduledJob) => scheduledJob !== `${appName}_${webhook.id}`
|
||||
(scheduledJob) => scheduledJob !== `${appId}_${webhook.id}`
|
||||
);
|
||||
await prisma.booking.update({
|
||||
where: {
|
||||
|
@ -118,7 +118,7 @@ export async function deleteSubscription({
|
|||
return deleteWebhook;
|
||||
} catch (err) {
|
||||
return console.error(
|
||||
`Error deleting subscription for user ${appApiKey.userId}, webhookId ${webhookId}, appName ${appName}`
|
||||
`Error deleting subscription for user ${appApiKey.userId}, webhookId ${webhookId}, appId ${appId}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||
const deleteEventSubscription = await deleteSubscription({
|
||||
appApiKey: validKey,
|
||||
webhookId: id,
|
||||
appName: "make",
|
||||
appId: "make",
|
||||
});
|
||||
|
||||
if (!deleteEventSubscription) {
|
||||
|
|
|
@ -26,7 +26,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||
const deleteEventSubscription = await deleteSubscription({
|
||||
appApiKey: validKey,
|
||||
webhookId: id,
|
||||
appName: "zapier",
|
||||
appId: "zapier",
|
||||
});
|
||||
|
||||
if (!deleteEventSubscription) {
|
||||
|
|
Loading…
Reference in New Issue