Refactor API code and simplify billing display

The code in the webhook API has been refactored to move the DatabaseWebhookHandlerService instance out of the POST function scope. Furthermore, the display of renewal plan details on the billing page has been simplified and certain parts deemed superfluous have been removed. Numerous types and interfaces in the database.types.ts file have also been corrected and formatted for consistency and improved readability.
This commit is contained in:
giancarlo
2024-03-31 15:13:44 +08:00
parent 2c0c616a2d
commit aa12ecd5a2
10 changed files with 1133 additions and 1026 deletions

View File

@@ -20,7 +20,7 @@ NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzd
NEXT_PUBLIC_REQUIRE_EMAIL_CONFIRMATION=true
## THIS IS FOR DEVELOPMENT ONLY - DO NOT USE IN PRODUCTION
SUPABASE_WEBHOOK_SECRET=WEBHOOKSECRET
SUPABASE_DB_WEBHOOK_SECRET=WEBHOOKSECRET
EMAIL_SENDER=test@makerkit.dev
EMAIL_PORT=54325

View File

@@ -9,9 +9,9 @@ const webhooksSecret = z
.min(1)
.parse(process.env.SUPABASE_DB_WEBHOOK_SECRET);
export async function POST(request: Request) {
const service = new DatabaseWebhookHandlerService();
const service = new DatabaseWebhookHandlerService();
export async function POST(request: Request) {
await service.handleWebhook(request, webhooksSecret);
return new Response(null, {