mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
70373: Store authenticated EPerson ID in store instead of object
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { EPerson } from '../core/eperson/models/eperson.model';
|
||||
import { select, Store } from '@ngrx/store';
|
||||
import { getAuthenticatedUser } from '../core/auth/selectors';
|
||||
import { AppState } from '../app.reducer';
|
||||
import { ProfilePageMetadataFormComponent } from './profile-page-metadata-form/profile-page-metadata-form.component';
|
||||
import { ProfilePageSecurityFormComponent } from './profile-page-security-form/profile-page-security-form.component';
|
||||
import { NotificationsService } from '../shared/notifications/notifications.service';
|
||||
@@ -13,9 +10,10 @@ import { RemoteData } from '../core/data/remote-data';
|
||||
import { PaginatedList } from '../core/data/paginated-list';
|
||||
import { filter, switchMap, tap } from 'rxjs/operators';
|
||||
import { EPersonDataService } from '../core/eperson/eperson-data.service';
|
||||
import { getAllSucceededRemoteData, getRemoteDataPayload, getSucceededRemoteData } from '../core/shared/operators';
|
||||
import { getAllSucceededRemoteData, getRemoteDataPayload } from '../core/shared/operators';
|
||||
import { hasValue } from '../shared/empty.util';
|
||||
import { followLink } from '../shared/utils/follow-link-config.model';
|
||||
import { AuthService } from '../core/auth/auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-profile-page',
|
||||
@@ -50,15 +48,14 @@ export class ProfilePageComponent implements OnInit {
|
||||
*/
|
||||
NOTIFICATIONS_PREFIX = 'profile.notifications.';
|
||||
|
||||
constructor(private store: Store<AppState>,
|
||||
constructor(private authService: AuthService,
|
||||
private notificationsService: NotificationsService,
|
||||
private translate: TranslateService,
|
||||
private epersonService: EPersonDataService) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.user$ = this.store.pipe(
|
||||
select(getAuthenticatedUser),
|
||||
this.user$ = this.authService.getAuthenticatedUserFromStore().pipe(
|
||||
filter((user: EPerson) => hasValue(user.id)),
|
||||
switchMap((user: EPerson) => this.epersonService.findById(user.id, followLink('groups'))),
|
||||
getAllSucceededRemoteData(),
|
||||
|
Reference in New Issue
Block a user