1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 02:33:46 +00:00

move premium component to it's own route

This commit is contained in:
Kyle Spearrin
2018-07-03 09:27:59 -04:00
parent 16c3d4c253
commit 70dbca67e7
7 changed files with 77 additions and 17 deletions

View File

@@ -2,6 +2,7 @@ import {
Component,
OnInit,
} from '@angular/core';
import { Router } from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
@@ -20,7 +21,6 @@ import { PaymentMethodType } from 'jslib/enums/paymentMethodType';
templateUrl: 'user-billing.component.html',
})
export class UserBillingComponent implements OnInit {
premium = false;
loading = false;
firstLoaded = false;
adjustStorageAdd = true;
@@ -36,7 +36,8 @@ export class UserBillingComponent implements OnInit {
constructor(private tokenService: TokenService, private apiService: ApiService,
private platformUtilsService: PlatformUtilsService, private i18nService: I18nService,
private analytics: Angulartics2, private toasterService: ToasterService) {
private analytics: Angulartics2, private toasterService: ToasterService,
private router: Router) {
this.selfHosted = platformUtilsService.isSelfHost();
}
@@ -50,11 +51,15 @@ export class UserBillingComponent implements OnInit {
return;
}
this.premium = this.tokenService.getPremium();
if (this.premium) {
const premium = this.tokenService.getPremium();
if (premium) {
this.loading = true;
this.billing = await this.apiService.getUserBilling();
} else {
this.router.navigate(['/settings/premium']);
return;
}
this.loading = false;
}