Skip to content

Commit

Permalink
fix: use take(1) inside handleStateChange instead of unsubscribe()
Browse files Browse the repository at this point in the history
  • Loading branch information
mselerin committed Feb 6, 2021
1 parent 4b813e4 commit 704679f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class BaseSecurityDirective implements OnInit, OnDestroy {

protected handleStateChange(): void {
this.isAuthorized().pipe(
take(1),
map(hasPerm => {
if (this.lastValue !== hasPerm) {
this.lastValue = hasPerm;
Expand All @@ -52,7 +53,7 @@ export class BaseSecurityDirective implements OnInit, OnDestroy {
this.viewContainer.createEmbeddedView(this.elseTemplateRef);
}
})
).subscribe().unsubscribe();
).subscribe();
}

/* istanbul ignore next */
Expand Down

0 comments on commit 704679f

Please sign in to comment.