Skip to content

Commit

Permalink
🐛fix unsubscribe in decoy list
Browse files Browse the repository at this point in the history
  • Loading branch information
TarradeMarc committed Dec 13, 2024
1 parent d842082 commit 11206bd
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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();
}

Expand Down

0 comments on commit 11206bd

Please sign in to comment.