mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-09-17 14:21:14 +00:00
safe unsubscribe (#75)
This commit is contained in:
committed by
Denys Vuika
parent
702614d8b0
commit
69f43d75f7
@@ -25,7 +25,7 @@ import { Subscription } from 'rxjs/Rx';
|
||||
styleUrls: [ './current-user.component.scss' ]
|
||||
})
|
||||
export class CurrentUserComponent implements OnInit, OnDestroy {
|
||||
private personSubscription: Subscription;
|
||||
private subscriptions: Subscription[] = [];
|
||||
|
||||
user: any = null;
|
||||
|
||||
@@ -35,14 +35,13 @@ export class CurrentUserComponent implements OnInit, OnDestroy {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.personSubscription = this.peopleApi.getCurrentPerson()
|
||||
.subscribe((person: any) => {
|
||||
this.user = person.entry;
|
||||
});
|
||||
this.subscriptions = this.subscriptions.concat([
|
||||
this.peopleApi.getCurrentPerson().subscribe((person: any) => this.user = person.entry)
|
||||
]);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.personSubscription.unsubscribe();
|
||||
this.subscriptions.forEach(s => s.unsubscribe());
|
||||
}
|
||||
|
||||
get userFirstName(): string {
|
||||
|
Reference in New Issue
Block a user