1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

refactor toaster to platform showToast

This commit is contained in:
Kyle Spearrin
2018-10-02 23:09:19 -04:00
parent 45341ec408
commit f793ff0aa5
21 changed files with 85 additions and 117 deletions

View File

@@ -4,7 +4,6 @@ import {
} from '@angular/core';
import { Router } from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { DeviceType } from '../../enums/deviceType';
@@ -43,7 +42,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
protected successRoute = 'vault';
constructor(protected authService: AuthService, protected router: Router,
protected analytics: Angulartics2, protected toasterService: ToasterService,
protected analytics: Angulartics2,
protected i18nService: I18nService, protected apiService: ApiService,
protected platformUtilsService: PlatformUtilsService, protected win: Window,
protected environmentService: EnvironmentService) {
@@ -69,7 +68,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
this.token = token;
this.submit();
}, (error: string) => {
this.toasterService.popAsync('error', this.i18nService.t('errorOccurred'), error);
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), error);
}, (info: string) => {
if (info === 'ready') {
this.u2fReady = true;
@@ -147,7 +146,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
async submit() {
if (this.token == null || this.token === '') {
this.toasterService.popAsync('error', this.i18nService.t('errorOccurred'),
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
this.i18nService.t('verificationCodeRequired'));
return;
}
@@ -196,7 +195,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
this.emailPromise = this.apiService.postTwoFactorEmail(request);
await this.emailPromise;
if (doToast) {
this.toasterService.popAsync('success', null,
this.platformUtilsService.showToast('success', null,
this.i18nService.t('verificationCodeEmailSent', this.twoFactorEmail));
}
} catch { }