Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Change loading logic for when hcaptcha is involved in payment summary panel enterprise

Joshen Limebed18fcfe8f
diff --git a/studio/components/interfaces/Billing/EnterpriseUpdate.tsx b/studio/components/interfaces/Billing/EnterpriseUpdate.tsx
index 77b10ab0809..ed599f91aa2 100644
--- a/studio/components/interfaces/Billing/EnterpriseUpdate.tsx
+++ b/studio/components/interfaces/Billing/EnterpriseUpdate.tsx
@@ -139,10 +139,14 @@ const EnterpriseUpdate: FC<Props> = ({
// Last todo to support enterprise billing on dashboard + E2E test
const onConfirmPayment = async () => {
- let token = captchaToken
+ setIsSubmitting(true)
+
+ const token =
+ captchaToken ?? (await captchaRef.current?.execute({ async: true }))?.response ?? undefined
+
if (!token) {
- const captchaResponse = await captchaRef.current?.execute({ async: true })
- token = captchaResponse?.response ?? null
+ setIsSubmitting(false)
+ return
}
const payload = {
@@ -157,8 +161,6 @@ const EnterpriseUpdate: FC<Props> = ({
),
tier: currentSubscription.tier.price_id,
}
-
- setIsSubmitting(true)
const res = await patch(`${API_URL}/projects/${projectRef}/subscription`, payload)
resetCaptcha()
diff --git a/studio/components/interfaces/Billing/ProUpgrade.tsx b/studio/components/interfaces/Billing/ProUpgrade.tsx
index 2b3357df770..a1a75ddc465 100644
--- a/studio/components/interfaces/Billing/ProUpgrade.tsx
+++ b/studio/components/interfaces/Billing/ProUpgrade.tsx
@@ -179,7 +179,6 @@ const ProUpgrade: FC<Props> = ({
token ?? undefined
)
const res = await patch(`${API_URL}/projects/${projectRef}/subscription`, payload)
-
resetCaptcha()
if (res?.error) {