stripe removed
This commit is contained in:
@@ -2,9 +2,7 @@ import { CommonModule } from '@angular/common';
|
||||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { AuthService } from '../../services/auth.service';
|
||||
import { SubscriptionsService } from '../../services/subscriptions.service';
|
||||
import { UserService } from '../../services/user.service';
|
||||
import { map2User } from '../../utils/utils';
|
||||
|
||||
@@ -21,7 +19,6 @@ export class LoginComponent {
|
||||
private activatedRoute: ActivatedRoute,
|
||||
|
||||
private router: Router,
|
||||
private subscriptionService: SubscriptionsService,
|
||||
private authService: AuthService,
|
||||
) {}
|
||||
async ngOnInit() {
|
||||
@@ -29,19 +26,17 @@ export class LoginComponent {
|
||||
const keycloakUser = map2User(token);
|
||||
const email = keycloakUser.email;
|
||||
const user = await this.userService.getByMail(email);
|
||||
if (!user.subscriptionPlan) {
|
||||
//this.router.navigate(['/pricing']);
|
||||
const subscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions(user.email));
|
||||
const activeSubscription = subscriptions.filter(s => s.status === 'active');
|
||||
if (activeSubscription.length > 0) {
|
||||
user.subscriptionPlan = activeSubscription[0].metadata['plan'] === 'Broker Plan' ? 'broker' : 'professional';
|
||||
this.userService.saveGuaranteed(user);
|
||||
} else {
|
||||
// Pricing page removed - redirect to home
|
||||
this.router.navigate([`/home`]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// if (!user.subscriptionPlan) {
|
||||
// const subscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions(user.email));
|
||||
// const activeSubscription = subscriptions.filter(s => s.status === 'active');
|
||||
// if (activeSubscription.length > 0) {
|
||||
// user.subscriptionPlan = activeSubscription[0].metadata['plan'] === 'Broker Plan' ? 'broker' : 'professional';
|
||||
// this.userService.saveGuaranteed(user);
|
||||
// } else {
|
||||
// this.router.navigate([`/home`]);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
this.router.navigate([`/${this.page}`]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user