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 = ({ // 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 = ({ ), 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 = ({ token ?? undefined ) const res = await patch(`${API_URL}/projects/${projectRef}/subscription`, payload) - resetCaptcha() if (res?.error) {