mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 22:03:36 +00:00
Use rxjs first instead of unsubscribe (#516)
This commit is contained in:
@@ -4,6 +4,8 @@ import {
|
|||||||
Router
|
Router
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
|
|
||||||
|
import { first } from 'rxjs/operators';
|
||||||
|
|
||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
||||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||||
@@ -25,7 +27,6 @@ import { ChangePasswordComponent as BaseChangePasswordComponent } from './change
|
|||||||
|
|
||||||
import { HashPurpose } from 'jslib-common/enums/hashPurpose';
|
import { HashPurpose } from 'jslib-common/enums/hashPurpose';
|
||||||
import { KdfType } from 'jslib-common/enums/kdfType';
|
import { KdfType } from 'jslib-common/enums/kdfType';
|
||||||
import { PolicyType } from 'jslib-common/enums/policyType';
|
|
||||||
|
|
||||||
import { Utils } from 'jslib-common/misc/utils';
|
import { Utils } from 'jslib-common/misc/utils';
|
||||||
|
|
||||||
@@ -53,14 +54,10 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
|
|||||||
await this.syncService.fullSync(true);
|
await this.syncService.fullSync(true);
|
||||||
this.syncLoading = false;
|
this.syncLoading = false;
|
||||||
|
|
||||||
const queryParamsSub = this.route.queryParams.subscribe(async qParams => {
|
this.route.queryParams.pipe(first()).subscribe(async qParams => {
|
||||||
if (qParams.identifier != null) {
|
if (qParams.identifier != null) {
|
||||||
this.identifier = qParams.identifier;
|
this.identifier = qParams.identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (queryParamsSub != null) {
|
|
||||||
queryParamsSub.unsubscribe();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Automatic Enrollment Detection
|
// Automatic Enrollment Detection
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import {
|
|||||||
Router,
|
Router,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
|
|
||||||
|
import { first } from 'rxjs/operators';
|
||||||
|
|
||||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||||
import { AuthService } from 'jslib-common/abstractions/auth.service';
|
import { AuthService } from 'jslib-common/abstractions/auth.service';
|
||||||
import { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.service';
|
import { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.service';
|
||||||
@@ -50,7 +52,7 @@ export class SsoComponent {
|
|||||||
protected passwordGenerationService: PasswordGenerationService) { }
|
protected passwordGenerationService: PasswordGenerationService) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
const queryParamsSub = this.route.queryParams.subscribe(async qParams => {
|
this.route.queryParams.pipe(first()).subscribe(async qParams => {
|
||||||
if (qParams.code != null && qParams.state != null) {
|
if (qParams.code != null && qParams.state != null) {
|
||||||
const codeVerifier = await this.storageService.get<string>(ConstantsService.ssoCodeVerifierKey);
|
const codeVerifier = await this.storageService.get<string>(ConstantsService.ssoCodeVerifierKey);
|
||||||
const state = await this.storageService.get<string>(ConstantsService.ssoStateKey);
|
const state = await this.storageService.get<string>(ConstantsService.ssoStateKey);
|
||||||
@@ -66,9 +68,6 @@ export class SsoComponent {
|
|||||||
this.codeChallenge = qParams.codeChallenge;
|
this.codeChallenge = qParams.codeChallenge;
|
||||||
this.clientId = qParams.clientId;
|
this.clientId = qParams.clientId;
|
||||||
}
|
}
|
||||||
if (queryParamsSub != null) {
|
|
||||||
queryParamsSub.unsubscribe();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user