mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +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 { NEXT_PUBLIC_WEBAPP_URL } from '../../../constants/app';
|
||||||
import { sign } from '../../crypto/sign';
|
import { sign } from '../../crypto/sign';
|
||||||
|
import { getAllWebhooksByEventTrigger } from '../get-all-webhooks-by-event-trigger';
|
||||||
|
|
||||||
export type TriggerWebhookOptions = {
|
export type TriggerWebhookOptions = {
|
||||||
event: WebhookTriggerEvents;
|
event: WebhookTriggerEvents;
|
||||||
@ -19,6 +20,12 @@ export const triggerWebhook = async ({ event, data, userId, teamId }: TriggerWeb
|
|||||||
teamId,
|
teamId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const registeredWebhooks = await getAllWebhooksByEventTrigger({ event, userId, teamId });
|
||||||
|
|
||||||
|
if (registeredWebhooks.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const signature = sign(body);
|
const signature = sign(body);
|
||||||
|
|
||||||
await Promise.race([
|
await Promise.race([
|
||||||
|
|||||||
Reference in New Issue
Block a user