1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-07 02:53:28 +00:00
Files
browser/apps/web/src/app/auth/settings/emergency-access/view/emergency-access-view.component.ts
Jordan Aasen afcb656d12 [PM-17747] - remove emergency access attachments dialog. fix 404 (#13854)
* remove emergency access attachments dialog. fix 404

* fix types

* fix type issue
2025-04-01 16:48:41 -07:00

52 lines
1.7 KiB
TypeScript

import { Component, OnInit, ViewChild, ViewContainerRef } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { firstValueFrom } from "rxjs";
import { EmergencyAccessId } from "@bitwarden/common/types/guid";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { DialogService } from "@bitwarden/components";
import { CipherFormConfigService, DefaultCipherFormConfigService } from "@bitwarden/vault";
import { EmergencyAccessService } from "../../../emergency-access";
import { EmergencyViewDialogComponent } from "./emergency-view-dialog.component";
@Component({
selector: "emergency-access-view",
templateUrl: "emergency-access-view.component.html",
providers: [{ provide: CipherFormConfigService, useClass: DefaultCipherFormConfigService }],
})
export class EmergencyAccessViewComponent implements OnInit {
@ViewChild("attachments", { read: ViewContainerRef, static: true })
id: EmergencyAccessId | null = null;
ciphers: CipherView[] = [];
loaded = false;
constructor(
private router: Router,
private route: ActivatedRoute,
private emergencyAccessService: EmergencyAccessService,
private dialogService: DialogService,
) {}
async ngOnInit() {
const qParams = await firstValueFrom(this.route.params);
if (qParams.id == null) {
await this.router.navigate(["settings/emergency-access"]);
return;
}
this.id = qParams.id;
this.ciphers = await this.emergencyAccessService.getViewOnlyCiphers(qParams.id);
this.loaded = true;
}
async selectCipher(cipher: CipherView) {
EmergencyViewDialogComponent.open(this.dialogService, {
cipher,
emergencyAccessId: this.id!,
});
return;
}
}