From aaffb0c26bd74c5e802f1c4bc88212fa9a92e1cf Mon Sep 17 00:00:00 2001 From: Ly Tuan Kiet Date: Tue, 3 Dec 2024 19:35:58 +0700 Subject: [PATCH] feat: make webhook and dispatchEvent methods asynchronous in ClerkService - Updated the webhook method to be asynchronous, allowing for better handling of asynchronous operations. - Changed the dispatchEvent method to be asynchronous to improve event processing and ensure proper handling of event data. - These changes enhance the responsiveness and reliability of the ClerkService when processing webhooks and dispatching events. --- src/Clerk/clerk.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Clerk/clerk.service.ts b/src/Clerk/clerk.service.ts index 732cd8f..edcbec0 100644 --- a/src/Clerk/clerk.service.ts +++ b/src/Clerk/clerk.service.ts @@ -10,7 +10,7 @@ export class ClerkService { private readonly prisma: PrismaService, private readonly redis: RedisService, ) {} - webhook(body: any) { + async webhook(body: any) { // get the event type const eventType = body.type // dispatch the event @@ -18,7 +18,7 @@ export class ClerkService { return { message: `Webhook received: ${eventType}` } } // dispatch the event - dispatchEvent(eventType: WebhookEventType, data: any) { + async dispatchEvent(eventType: WebhookEventType, data: any) { // event types: // user.created // user.updated