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}`]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ import { ChangeDetectorRef, Component } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||
import { NgSelectModule } from '@ng-select/ng-select';
|
||||
import { NgxCurrencyDirective } from 'ngx-currency';
|
||||
import { ImageCropperComponent } from 'ngx-image-cropper';
|
||||
import { QuillModule } from 'ngx-quill';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||
@@ -13,10 +11,8 @@ import { environment } from '../../../../environments/environment';
|
||||
import { ConfirmationComponent } from '../../../components/confirmation/confirmation.component';
|
||||
import { ConfirmationService } from '../../../components/confirmation/confirmation.service';
|
||||
import { ImageCropAndUploadComponent, UploadReponse } from '../../../components/image-crop-and-upload/image-crop-and-upload.component';
|
||||
import { MessageComponent } from '../../../components/message/message.component';
|
||||
import { MessageService } from '../../../components/message/message.service';
|
||||
import { TooltipComponent } from '../../../components/tooltip/tooltip.component';
|
||||
import { ValidatedCityComponent } from '../../../components/validated-city/validated-city.component';
|
||||
import { ValidatedCountyComponent } from '../../../components/validated-county/validated-county.component';
|
||||
import { ValidatedInputComponent } from '../../../components/validated-input/validated-input.component';
|
||||
import { ValidatedLocationComponent } from '../../../components/validated-location/validated-location.component';
|
||||
@@ -72,7 +68,6 @@ export class AccountComponent {
|
||||
customerSubTypeOptions: Array<{ value: string; label: string }> = [];
|
||||
tooltipTargetAreasServed = 'tooltip-areasServed';
|
||||
tooltipTargetLicensed = 'tooltip-licensedIn';
|
||||
// subscriptions: StripeSubscription[] | any[];
|
||||
constructor(
|
||||
public userService: UserService,
|
||||
private geoService: GeoService,
|
||||
@@ -87,7 +82,6 @@ export class AccountComponent {
|
||||
private sharedService: SharedService,
|
||||
private titleCasePipe: TitleCasePipe,
|
||||
private validationMessagesService: ValidationMessagesService,
|
||||
// private subscriptionService: SubscriptionsService,
|
||||
private datePipe: DatePipe,
|
||||
private router: Router,
|
||||
public authService: AuthService,
|
||||
|
||||
Reference in New Issue
Block a user