Accept that capabilities API may return an elements: undefined result

pull/9685/head
Oliver Günther 3 years ago
parent acb7ebec3d
commit 36b83673d8
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 2
      frontend/src/app/core/apiv3/cache/cachable-apiv3-collection.ts
  2. 2
      frontend/src/app/core/current-user/current-user.service.ts

@ -60,7 +60,7 @@ export abstract class CachableAPIV3Collection<
tap(
(response:R) => {
if (response instanceof CollectionResource) {
response.elements.forEach(this.touch.bind(this));
response.elements?.forEach(this.touch.bind(this));
} else if (response instanceof HalResource) {
this.touch(response as any);
}

@ -124,6 +124,8 @@ export class CurrentUserService {
// The current page is the only page, return the results.
return of(data.elements);
}),
// Elements may incorrectly be undefined here due to the way the representer works
map((elements) => elements || []),
)
.subscribe((capabilities) => {
this.currentUserStore.update((state) => ({

Loading…
Cancel
Save