Skip to content

Commit ca167a2

Browse files
Prevent /api/eperson/profiles/{userId} to be called when unauthenticated
1 parent 08027bb commit ca167a2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/app/notifications/suggestions.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {
3838
import { WorkspaceItem } from '../core/submission/models/workspaceitem.model';
3939
import { WorkspaceitemDataService } from '../core/submission/workspaceitem-data.service';
4040
import {
41+
hasNoValue,
4142
hasValue,
4243
isNotEmpty,
4344
} from '../shared/empty.util';
@@ -165,6 +166,9 @@ export class SuggestionsService {
165166
* The EPerson id for which to retrieve suggestion targets
166167
*/
167168
public retrieveCurrentUserSuggestions(userUuid: string): Observable<SuggestionTarget[]> {
169+
if (hasNoValue(userUuid)) {
170+
return of([]);
171+
}
168172
return this.researcherProfileService.findById(userUuid, true).pipe(
169173
getFirstCompletedRemoteData(),
170174
mergeMap((profile: RemoteData<ResearcherProfile> ) => {

0 commit comments

Comments
 (0)