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.
This commit is contained in:
2024-12-03 19:35:58 +07:00
parent 9f9f595fee
commit aaffb0c26b

View File

@@ -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