From 8dd4c51534f59fa5ad4681bb6de07bf771b6d538 Mon Sep 17 00:00:00 2001 From: Jared Snider Date: Fri, 20 Dec 2024 14:29:13 -0500 Subject: [PATCH] PM-8113 - TwoFactorAuthComp - add destroy ref to fix warnings. --- .../angular/two-factor-auth/two-factor-auth.component.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.ts b/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.ts index 1758343714f..3d4be1bea68 100644 --- a/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.ts +++ b/libs/auth/src/angular/two-factor-auth/two-factor-auth.component.ts @@ -2,7 +2,7 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore import { CommonModule } from "@angular/common"; -import { Component, Inject, OnDestroy, OnInit, ViewChild } from "@angular/core"; +import { Component, DestroyRef, Inject, OnDestroy, OnInit, ViewChild } from "@angular/core"; import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; import { FormBuilder, ReactiveFormsModule, Validators } from "@angular/forms"; import { ActivatedRoute, Router, RouterLink } from "@angular/router"; @@ -131,6 +131,7 @@ export class TwoFactorAuthComponent implements OnInit, OnDestroy { private twoFactorAuthComponentService: TwoFactorAuthComponentService, private syncService: SyncService, private messagingService: MessagingService, + private destroyRef: DestroyRef, ) {} async ngOnInit() { @@ -146,7 +147,7 @@ export class TwoFactorAuthComponent implements OnInit, OnDestroy { await this.set2faProviderData(); await this.setTitleByTwoFactorProviderType(); - this.form.valueChanges.pipe(takeUntilDestroyed()).subscribe((value) => { + this.form.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => { this.token = value.token; this.remember = value.remember; }); @@ -181,7 +182,7 @@ export class TwoFactorAuthComponent implements OnInit, OnDestroy { private listenFor2faSessionTimeout() { this.loginStrategyService.twoFactorTimeout$ - .pipe(takeUntilDestroyed()) + .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe(async (expired) => { if (!expired) { return;