Commits

Giuseppe Digilio authored f90880bbace
[DURACOM-191] Fix error on home when coar is not enabled
No tags

src/app/core/coar-notify/notify-info/notify-info.service.ts

Modified
1 1 import { Injectable } from '@angular/core';
2 -import { getFirstSucceededRemoteData, getRemoteDataPayload } from '../../shared/operators';
2 +import { getFirstCompletedRemoteData } from '../../shared/operators';
3 3 import { ConfigurationDataService } from '../../data/configuration-data.service';
4 4 import { map, Observable } from 'rxjs';
5 5 import { ConfigurationProperty } from '../../shared/configuration-property.model';
6 6 import { AuthorizationDataService } from '../../data/feature-authorization/authorization-data.service';
7 7 import { FeatureID } from '../../data/feature-authorization/feature-id';
8 +import { RemoteData } from '../../data/remote-data';
8 9
9 10 /**
10 11 * Service to check COAR availability and LDN services information for the COAR Notify functionalities
11 12 */
12 13 @Injectable({
13 14 providedIn: 'root'
14 15 })
15 16 export class NotifyInfoService {
16 17
17 18 /**
27 28 isCoarConfigEnabled(): Observable<boolean> {
28 29 return this.authorizationService.isAuthorized(FeatureID.CoarNotifyEnabled);
29 30 }
30 31
31 32 /**
32 33 * Get the url of the local inbox from the REST configuration
33 34 * @returns the url of the local inbox
34 35 */
35 36 getCoarLdnLocalInboxUrls(): Observable<string[]> {
36 37 return this.configService.findByPropertyName('ldn.notify.inbox').pipe(
37 - getFirstSucceededRemoteData(),
38 - getRemoteDataPayload(),
39 - map((response: ConfigurationProperty) => {
40 - return response.values;
41 - })
38 + getFirstCompletedRemoteData(),
39 + map((responseRD: RemoteData<ConfigurationProperty>) => responseRD.hasSucceeded ? responseRD.payload.values : [])
42 40 );
43 41 }
44 42
45 43 /**
46 44 * Method to get the relation link for the inbox
47 45 * @returns the relation link for the inbox
48 46 */
49 47 getInboxRelationLink(): string {
50 48 return this._inboxRelationLink;
51 49 }
52 50 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut