mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
fix: add early return to webhook trigger
This commit is contained in:
@ -2,6 +2,7 @@ import type { WebhookTriggerEvents } from '@documenso/prisma/client';
|
||||
|
||||
import { NEXT_PUBLIC_WEBAPP_URL } from '../../../constants/app';
|
||||
import { sign } from '../../crypto/sign';
|
||||
import { getAllWebhooksByEventTrigger } from '../get-all-webhooks-by-event-trigger';
|
||||
|
||||
export type TriggerWebhookOptions = {
|
||||
event: WebhookTriggerEvents;
|
||||
@ -19,6 +20,12 @@ export const triggerWebhook = async ({ event, data, userId, teamId }: TriggerWeb
|
||||
teamId,
|
||||
};
|
||||
|
||||
const registeredWebhooks = await getAllWebhooksByEventTrigger({ event, userId, teamId });
|
||||
|
||||
if (registeredWebhooks.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const signature = sign(body);
|
||||
|
||||
await Promise.race([
|
||||
|
||||
Reference in New Issue
Block a user