bitwarden-estensione-browser/apps/web/src/app/vault/bulk-restore.component.ts

30 lines
985 B
TypeScript

import { Component, EventEmitter, Input, Output } from "@angular/core";
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
@Component({
selector: "app-vault-bulk-restore",
templateUrl: "bulk-restore.component.html",
})
export class BulkRestoreComponent {
@Input() cipherIds: string[] = [];
@Output() onRestored = new EventEmitter();
formPromise: Promise<any>;
constructor(
private cipherService: CipherService,
private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService
) {}
async submit() {
this.formPromise = this.cipherService.restoreManyWithServer(this.cipherIds);
await this.formPromise;
this.onRestored.emit();
this.platformUtilsService.showToast("success", null, this.i18nService.t("restoredItems"));
}
}