@@ -21,6 +21,7 @@ import { map2User } from '../../utils/utils';
|
||||
export class PricingComponent {
|
||||
private apiBaseUrl = environment.apiBaseUrl;
|
||||
private id: string | undefined = this.activatedRoute.snapshot.params['id'] as string | undefined;
|
||||
pricingOverview: boolean | undefined = this.activatedRoute.snapshot.data['pricingOverview'] as boolean | undefined;
|
||||
keycloakUser: KeycloakUser;
|
||||
user: User;
|
||||
constructor(public keycloakService: KeycloakService, private http: HttpClient, private stripeService: StripeService, private activatedRoute: ActivatedRoute, private userService: UserService, private router: Router) {}
|
||||
@@ -36,12 +37,14 @@ export class PricingComponent {
|
||||
this.router.navigate([`/account`]);
|
||||
} else if (this.id) {
|
||||
this.checkout({ priceId: atob(this.id), email: this.keycloakUser.email, name: `${this.keycloakUser.firstName} ${this.keycloakUser.lastName}` });
|
||||
} else if (!this.id) {
|
||||
} else if (!this.id && !this.pricingOverview) {
|
||||
this.user = await this.userService.getByMail(this.keycloakUser.email);
|
||||
if (this.user.subscriptionId) {
|
||||
this.router.navigate([`/account`]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.pricingOverview = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user