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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user