Browse Source

refactor(account): add takeUntilDestroy to store select stream

pull/2610/head
mehmet-erim 6 years ago
parent
commit
75c005b6cc
  1. 20
      npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.ts

20
npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.ts

@ -1,8 +1,7 @@
import { Component, Input, TemplateRef, OnInit, OnDestroy } from '@angular/core';
import { ConfigState, takeUntilDestroy } from '@abp/ng.core';
import { Component, Input, OnDestroy, OnInit, TemplateRef } from '@angular/core';
import { Store } from '@ngxs/store';
import { Account } from '../../models/account';
import { Select, Store } from '@ngxs/store';
import { ConfigState } from '@abp/ng.core';
import { Observable } from 'rxjs';
@Component({
selector: 'abp-auth-wrapper',
@ -26,11 +25,14 @@ export class AuthWrapperComponent
constructor(private store: Store) {}
ngOnInit() {
this.store.select(ConfigState.getSetting('Abp.Account.EnableLocalLogin')).subscribe(value => {
if (value) {
this.enableLocalLogin = value.toLowerCase() !== 'false';
}
});
this.store
.select(ConfigState.getSetting('Abp.Account.EnableLocalLogin'))
.pipe(takeUntilDestroy(this))
.subscribe(value => {
if (value) {
this.enableLocalLogin = value.toLowerCase() !== 'false';
}
});
}
ngOnDestroy() {}

Loading…
Cancel
Save