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:
@@ -10,7 +10,7 @@ export class ClerkService {
|
|||||||
private readonly prisma: PrismaService,
|
private readonly prisma: PrismaService,
|
||||||
private readonly redis: RedisService,
|
private readonly redis: RedisService,
|
||||||
) {}
|
) {}
|
||||||
webhook(body: any) {
|
async webhook(body: any) {
|
||||||
// get the event type
|
// get the event type
|
||||||
const eventType = body.type
|
const eventType = body.type
|
||||||
// dispatch the event
|
// dispatch the event
|
||||||
@@ -18,7 +18,7 @@ export class ClerkService {
|
|||||||
return { message: `Webhook received: ${eventType}` }
|
return { message: `Webhook received: ${eventType}` }
|
||||||
}
|
}
|
||||||
// dispatch the event
|
// dispatch the event
|
||||||
dispatchEvent(eventType: WebhookEventType, data: any) {
|
async dispatchEvent(eventType: WebhookEventType, data: any) {
|
||||||
// event types:
|
// event types:
|
||||||
// user.created
|
// user.created
|
||||||
// user.updated
|
// user.updated
|
||||||
|
|||||||
Reference in New Issue
Block a user