bitwarden-estensione-browser/src/popup/vault/attachments.component.ts

43 lines
1.6 KiB
TypeScript
Raw Normal View History

2018-04-11 19:51:09 +02:00
import { Location } from '@angular/common';
import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
2018-04-11 19:51:09 +02:00
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
2018-08-29 15:26:43 +02:00
import { UserService } from 'jslib/abstractions/user.service';
2018-04-11 19:51:09 +02:00
import { AttachmentsComponent as BaseAttachmentsComponent } from 'jslib/angular/components/attachments.component';
@Component({
selector: 'app-vault-attachments',
templateUrl: 'attachments.component.html',
})
export class AttachmentsComponent extends BaseAttachmentsComponent {
constructor(cipherService: CipherService, i18nService: I18nService,
2018-08-29 15:26:43 +02:00
cryptoService: CryptoService, userService: UserService,
2018-04-11 19:51:09 +02:00
platformUtilsService: PlatformUtilsService, private location: Location,
private route: ActivatedRoute, private router: Router) {
super(cipherService, i18nService, cryptoService, userService, platformUtilsService, window);
2018-04-11 19:51:09 +02:00
}
async ngOnInit() {
2018-12-20 16:20:57 +01:00
const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
2018-04-11 19:51:09 +02:00
this.cipherId = params.cipherId;
2019-03-06 20:31:50 +01:00
await this.init();
2019-01-17 05:30:39 +01:00
if (queryParamsSub != null) {
queryParamsSub.unsubscribe();
}
2018-04-11 19:51:09 +02:00
});
}
back() {
if (document.referrer === "") {
this.router.navigate(['/edit-cipher'], { queryParams: { cipherId: this.cipher.id } });
} else {
this.location.back();
}
2018-04-11 19:51:09 +02:00
}
}