mirror of
https://github.com/bitwarden/web
synced 2026-01-06 10:33:17 +00:00
Replace toaster library (#1322)
This commit is contained in:
@@ -4,8 +4,6 @@ import {
|
||||
} from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { ToasterService } from 'angular2-toaster';
|
||||
|
||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||
import { ImportOption, ImportService } from 'jslib-common/abstractions/import.service';
|
||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||
@@ -32,7 +30,7 @@ export class ImportComponent implements OnInit {
|
||||
protected organizationId: string = null;
|
||||
protected successNavigate: any[] = ['vault'];
|
||||
|
||||
constructor(protected i18nService: I18nService, protected toasterService: ToasterService,
|
||||
constructor(protected i18nService: I18nService,
|
||||
protected importService: ImportService, protected router: Router,
|
||||
protected platformUtilsService: PlatformUtilsService, protected policyService: PolicyService,
|
||||
private logService: LogService) { }
|
||||
@@ -68,7 +66,7 @@ export class ImportComponent implements OnInit {
|
||||
|
||||
const importer = this.importService.getImporter(this.format, this.organizationId);
|
||||
if (importer === null) {
|
||||
this.toasterService.popAsync('error', this.i18nService.t('errorOccurred'),
|
||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
||||
this.i18nService.t('selectFormat'));
|
||||
this.loading = false;
|
||||
return;
|
||||
@@ -77,7 +75,7 @@ export class ImportComponent implements OnInit {
|
||||
const fileEl = document.getElementById('file') as HTMLInputElement;
|
||||
const files = fileEl.files;
|
||||
if ((files == null || files.length === 0) && (this.fileContents == null || this.fileContents === '')) {
|
||||
this.toasterService.popAsync('error', this.i18nService.t('errorOccurred'),
|
||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
||||
this.i18nService.t('selectFile'));
|
||||
this.loading = false;
|
||||
return;
|
||||
@@ -96,7 +94,7 @@ export class ImportComponent implements OnInit {
|
||||
}
|
||||
|
||||
if (fileContents == null || fileContents === '') {
|
||||
this.toasterService.popAsync('error', this.i18nService.t('errorOccurred'),
|
||||
this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),
|
||||
this.i18nService.t('selectFile'));
|
||||
this.loading = false;
|
||||
return;
|
||||
@@ -110,7 +108,7 @@ export class ImportComponent implements OnInit {
|
||||
this.loading = false;
|
||||
return;
|
||||
}
|
||||
this.toasterService.popAsync('success', null, this.i18nService.t('importSuccess'));
|
||||
this.platformUtilsService.showToast('success', null, this.i18nService.t('importSuccess'));
|
||||
this.router.navigate(this.successNavigate);
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
|
||||
Reference in New Issue
Block a user