1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

[Refactor] Use rxjs first instead of unsubscribe from queryParams (#2112)

* Use rxjs first instead of unsubscribe

* Update jslib
This commit is contained in:
Thomas Rittson
2021-10-15 07:58:59 +10:00
committed by GitHub
parent 2c2de6a233
commit 82138a08ff
13 changed files with 37 additions and 52 deletions

View File

@@ -2,6 +2,8 @@ import { Location } from '@angular/common';
import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { first } from 'rxjs/operators';
import { ApiService } from 'jslib-common/abstractions/api.service';
import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
@@ -26,12 +28,9 @@ export class AttachmentsComponent extends BaseAttachmentsComponent {
}
async ngOnInit() {
const queryParamsSub = this.route.queryParams.subscribe(async params => {
this.route.queryParams.pipe(first()).subscribe(async params => {
this.cipherId = params.cipherId;
await this.init();
if (queryParamsSub != null) {
queryParamsSub.unsubscribe();
}
});
this.openedAttachmentsInPopup = history.length === 1;