Skip to content

Commit

Permalink
Prevent /api/eperson/profiles/{userId} to be called when unauthenticated
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrevryghem committed Mar 17, 2024
1 parent 9a7e43c commit 2123c3b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/notifications/suggestions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
import { WorkspaceItem } from '../core/submission/models/workspaceitem.model';
import { WorkspaceitemDataService } from '../core/submission/workspaceitem-data.service';
import {
hasNoValue,
hasValue,
isNotEmpty,
} from '../shared/empty.util';
Expand Down Expand Up @@ -165,6 +166,9 @@ export class SuggestionsService {
* The EPerson id for which to retrieve suggestion targets
*/
public retrieveCurrentUserSuggestions(userUuid: string): Observable<SuggestionTarget[]> {
if (hasNoValue(userUuid)) {
return of([]);
}
return this.researcherProfileService.findById(userUuid, true).pipe(
getFirstCompletedRemoteData(),
mergeMap((profile: RemoteData<ResearcherProfile> ) => {
Expand Down

0 comments on commit 2123c3b

Please sign in to comment.