From 11206bd5ed79817ac8c7e21f038b27c2dfc40359 Mon Sep 17 00:00:00 2001 From: "mtarrade.sap@gmail.com" Date: Fri, 13 Dec 2024 14:33:28 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9Bfix=20unsubscribe=20in=20decoy=20li?= =?UTF-8?q?st?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cad/src/app/pages/list-decoy/list-decoy.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/controlpanel/cad/src/app/pages/list-decoy/list-decoy.component.ts b/controlpanel/cad/src/app/pages/list-decoy/list-decoy.component.ts index 25ef35c..5ee5be5 100644 --- a/controlpanel/cad/src/app/pages/list-decoy/list-decoy.component.ts +++ b/controlpanel/cad/src/app/pages/list-decoy/list-decoy.component.ts @@ -9,6 +9,7 @@ import { GlobalStateService } from '../../services/global-state.service'; import { isProtectedAppEmpty } from '../../models/protected-app'; import { RouterLink } from '@angular/router'; import { UUID } from '../../models/types'; +import { Subscription } from 'rxjs'; @Component({ selector: 'app-list-decoy', @@ -19,17 +20,19 @@ import { UUID } from '../../models/types'; }) export class ListDecoyComponent implements OnInit, OnDestroy { decoys: DecoyData[] = []; + globalStateSubscription?: Subscription; constructor(private decoyService: DecoyService, private toastr: ToastrService, private globalState: GlobalStateService) { } async ngOnInit() { - this.globalState.selectedApp$.subscribe(data => { + this.globalStateSubscription = this.globalState.selectedApp$.subscribe(data => { if (isProtectedAppEmpty(data)) return; this.getDecoyList(); }); } ngOnDestroy(): void { + this.globalStateSubscription?.unsubscribe(); this.save(); }