61561: resolving second todo in auth srvice

This commit is contained in:
lotte
2019-04-08 15:55:09 +02:00
parent 1ceae322de
commit b443890848
10 changed files with 29 additions and 21 deletions

View File

@@ -146,14 +146,10 @@ export class AuthService {
headers = headers.append('Authorization', `Bearer ${token.accessToken}`);
options.headers = headers;
return this.authRequestService.getRequest('status', options).pipe(
map((status) => this.rdbService.build(status)),
switchMap((status: AuthStatus) => {
if (status.authenticated) {
// TODO this should be cleaned up, AuthStatus could be parsed by the RemoteDataService as a whole...
// Review when https://jira.duraspace.org/browse/DS-4006 is fixed
// See https://github.com/DSpace/dspace-angular/issues/292
const person$ = this.rdbService.buildSingle<EPerson>(status.eperson.toString());
return person$.pipe(map((eperson) => eperson.payload));
return status.eperson.pipe(map((eperson) => eperson.payload));
} else {
throw(new Error('Not authenticated'));
}