From 1c1f080acf0c130b5344c2a729248e1327a46e09 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Wed, 1 Sep 2021 07:19:16 +1000 Subject: [PATCH] Fix undefined variable error in desktop (#470) --- angular/src/components/two-factor.component.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/angular/src/components/two-factor.component.ts b/angular/src/components/two-factor.component.ts index 9369482d055..cd41dd3114c 100644 --- a/angular/src/components/two-factor.component.ts +++ b/angular/src/components/two-factor.component.ts @@ -5,6 +5,8 @@ import { Router, } from '@angular/router'; +import { first } from 'rxjs/operators'; + import { TwoFactorProviderType } from 'jslib-common/enums/twoFactorProviderType'; import { TwoFactorEmailRequest } from 'jslib-common/models/request/twoFactorEmailRequest'; @@ -65,14 +67,10 @@ export class TwoFactorComponent implements OnInit, OnDestroy { return; } - const queryParamsSub = this.route.queryParams.subscribe(async qParams => { + this.route.queryParams.pipe(first()).subscribe(qParams => { if (qParams.identifier != null) { this.identifier = qParams.identifier; } - - if (queryParamsSub != null) { - queryParamsSub.unsubscribe(); - } }); if (this.needsLock) {