Skip to content

Commit f4d1df5

Browse files
committed
fix: redirect to checkout page for existing users
1 parent 9c47ee0 commit f4d1df5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/composables/auth/useFirebaseAuthActions.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ export const useFirebaseAuthActions = () => {
104104
}, reportError)
105105

106106
const accessBillingPortal = wrapWithErrorHandlingAsync<
107-
[targetTier?: BillingPortalTargetTier],
107+
[targetTier?: BillingPortalTargetTier, openInNewTab?: boolean],
108108
void
109-
>(async (targetTier) => {
109+
>(async (targetTier, openInNewTab = true) => {
110110
const response = await authStore.accessBillingPortal(targetTier)
111111
if (!response.billing_portal_url) {
112112
throw new Error(
@@ -115,7 +115,11 @@ export const useFirebaseAuthActions = () => {
115115
})
116116
)
117117
}
118-
window.open(response.billing_portal_url, '_blank')
118+
if (openInNewTab) {
119+
window.open(response.billing_portal_url, '_blank')
120+
} else {
121+
globalThis.location.href = response.billing_portal_url
122+
}
119123
}, reportError)
120124

121125
const fetchBalance = wrapWithErrorHandlingAsync(async () => {

src/platform/cloud/onboarding/CloudSubscriptionRedirectView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const runRedirect = wrapWithErrorHandlingAsync(async () => {
6363
}
6464
6565
if (isActiveSubscription.value) {
66-
await accessBillingPortal()
66+
await accessBillingPortal(undefined, false)
6767
} else {
6868
await performSubscriptionCheckout(tierKey, 'monthly', false)
6969
}

0 commit comments

Comments
 (0)