mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-09-17 14:21:14 +00:00
simplify user component (#447)
* simplify user component * language picker selector
This commit is contained in:
committed by
Cilibiu Bogdan
parent
045c4ee9a2
commit
bc554bb8d3
@@ -23,13 +23,11 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
|
||||
import { Subscription } from 'rxjs/Rx';
|
||||
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { selectUser } from '../../store/selectors/app.selectors';
|
||||
import { ProfileState } from '../../store/states/profile.state';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { selectUser, appLanguagePicker } from '../../store/selectors/app.selectors';
|
||||
import { AppStore, ProfileState } from '../../store/states';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-current-user',
|
||||
@@ -37,20 +35,12 @@ import { ProfileState } from '../../store/states/profile.state';
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
host: { class: 'aca-current-user' }
|
||||
})
|
||||
export class CurrentUserComponent implements OnInit, OnDestroy {
|
||||
private subscriptions: Subscription[] = [];
|
||||
export class CurrentUserComponent {
|
||||
profile$: Observable<ProfileState>;
|
||||
languagePicker$: Observable<boolean>;
|
||||
|
||||
user: ProfileState;
|
||||
|
||||
constructor(private store: Store<AppStore>) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.subscriptions = this.subscriptions.concat([
|
||||
this.store.select(selectUser).subscribe((user) => this.user = user)
|
||||
]);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(s => s.unsubscribe());
|
||||
constructor(store: Store<AppStore>) {
|
||||
this.profile$ = store.select(selectUser);
|
||||
this.languagePicker$ = store.select(appLanguagePicker);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user