From 95c720d7bf8adecff454e9894e04e776b88c57b1 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 7 Dec 2024 09:42:47 +0100 Subject: [PATCH] Setup API key strategy --- .../user-account-membership.component.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/client/src/app/components/user-account-membership/user-account-membership.component.ts b/apps/client/src/app/components/user-account-membership/user-account-membership.component.ts index f83969d86..9b9242dfa 100644 --- a/apps/client/src/app/components/user-account-membership/user-account-membership.component.ts +++ b/apps/client/src/app/components/user-account-membership/user-account-membership.component.ts @@ -107,15 +107,15 @@ export class UserAccountMembershipComponent implements OnDestroy { this.dataService .createCheckoutSession({ couponId: this.couponId, priceId: this.priceId }) .pipe( - switchMap(({ sessionId }: { sessionId: string }) => { - return this.stripeService.redirectToCheckout({ sessionId }); - }), catchError((error) => { this.notificationService.alert({ title: error.message }); throw error; + }), + switchMap(({ sessionId }: { sessionId: string }) => { + return this.stripeService.redirectToCheckout({ sessionId }); }) ) .subscribe((result) => { @@ -133,7 +133,6 @@ export class UserAccountMembershipComponent implements OnDestroy { this.dataService .postApiKey() .pipe( - takeUntil(this.unsubscribeSubject), catchError(() => { this.snackBar.open( '😞 ' + $localize`Could not generate an API key`, @@ -144,7 +143,8 @@ export class UserAccountMembershipComponent implements OnDestroy { ); return EMPTY; - }) + }), + takeUntil(this.unsubscribeSubject) ) .subscribe(({ apiKey }) => { this.notificationService.alert({ @@ -170,7 +170,6 @@ export class UserAccountMembershipComponent implements OnDestroy { this.dataService .redeemCoupon(couponCode) .pipe( - takeUntil(this.unsubscribeSubject), catchError(() => { this.snackBar.open( '😞 ' + $localize`Could not redeem coupon code`, @@ -181,7 +180,8 @@ export class UserAccountMembershipComponent implements OnDestroy { ); return EMPTY; - }) + }), + takeUntil(this.unsubscribeSubject) ) .subscribe(() => { this.snackBarRef = this.snackBar.open(