File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed
apps/client/src/pages/home Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 2626 label =" Manage subscription"
2727 color =" secondary"
2828 type =" submit"
29- @click =" createPortalSession ()"
29+ @click =" manageSubscription ()"
3030 />
3131
3232 <template v-if =" $q .platform .is .capacitor && $q .platform .is .ios " >
@@ -91,10 +91,25 @@ onMounted(async () => {
9191 loading .value = false ;
9292});
9393
94+ async function manageSubscription() {
95+ if ($quasar ().platform .is .capacitor && $quasar ().platform .is .ios ) {
96+ await manageIOSSubscription ();
97+ } else {
98+ await createPortalSession ();
99+ }
100+ }
101+
102+ async function manageIOSSubscription() {
103+ const managementURL = (await Purchases .getCustomerInfo ()).customerInfo
104+ .managementURL ! ;
105+
106+ window .open (managementURL , ' _blank' );
107+ }
108+
94109async function createPortalSession() {
95110 const { portalSessionUrl } =
96111 await trpcClient .users .account .stripe .createPortalSession .mutate ();
97112
98- location . href = portalSessionUrl ;
113+ window . open ( portalSessionUrl , ' _blank ' ) ;
99114}
100115 </script >
Original file line number Diff line number Diff line change @@ -238,12 +238,19 @@ async function buyPackage() {
238238
239239async function manageSubscription() {
240240 if ($quasar ().platform .is .capacitor && $quasar ().platform .is .ios ) {
241- await buyPackage ();
241+ await manageIOSSubscription ();
242242 } else {
243243 await createPortalSession ();
244244 }
245245}
246246
247+ async function manageIOSSubscription() {
248+ const managementURL = (await Purchases .getCustomerInfo ()).customerInfo
249+ .managementURL ! ;
250+
251+ window .open (managementURL , ' _blank' );
252+ }
253+
247254async function createPortalSession() {
248255 const { portalSessionUrl } =
249256 await trpcClient .users .account .stripe .createPortalSession .mutate ();
You can’t perform that action at this time.
0 commit comments