Refactor code and improve error handling in authentication methods

This commit contains several changes including the removal of an unused onClick event handler in remove-member-dialog.tsx. It also includes an update to the POST handler in the Webhook route of the database API where the authentication property has been updated. Lastly, it also brings improvements in error handling and logging in various areas, such as e2e authentication tests and the mailbox utility.
This commit is contained in:
giancarlo
2024-05-03 23:56:23 +07:00
parent e159c52d41
commit 08c86102d8
5 changed files with 62 additions and 45 deletions

View File

@@ -5,17 +5,22 @@ import { enhanceRouteHandler } from '@kit/next/routes';
* @name POST
* @description POST handler for the webhook route that handles the webhook event
*/
export const POST = enhanceRouteHandler(async ({ request }) => {
const service = getDatabaseWebhookHandlerService();
export const POST = enhanceRouteHandler(
async ({ request }) => {
const service = getDatabaseWebhookHandlerService();
try {
// handle the webhook event
await service.handleWebhook(request);
try {
// handle the webhook event
await service.handleWebhook(request);
// return a successful response
return new Response(null, { status: 200 });
} catch (error) {
// return an error response
return new Response(null, { status: 500 });
}
});
// return a successful response
return new Response(null, { status: 200 });
} catch (error) {
// return an error response
return new Response(null, { status: 500 });
}
},
{
auth: false,
},
);