From a7dccebbf9c8d9735645af8bd784ce170113349d Mon Sep 17 00:00:00 2001 From: Camille Moinier Date: Thu, 30 May 2024 16:38:22 +0200 Subject: [PATCH] feat: don't display ogc in map if ogc service down --- libs/feature/dataviz/src/lib/service/data.service.ts | 4 +++- libs/feature/record/src/lib/state/mdview.facade.ts | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/feature/dataviz/src/lib/service/data.service.ts b/libs/feature/dataviz/src/lib/service/data.service.ts index c428511bd6..8380d0503e 100644 --- a/libs/feature/dataviz/src/lib/service/data.service.ts +++ b/libs/feature/dataviz/src/lib/service/data.service.ts @@ -188,7 +188,9 @@ export class DataService { const endpoint = new OgcApiEndpoint(this.proxy.getProxiedUrl(url)) return await endpoint.featureCollections .then((collections) => { - return endpoint.getCollectionItem(collections[0], '1') + return collections.length + ? endpoint.getCollectionItem(collections[0], '1') + : null }) .catch((error) => { throw new Error(`ogc.unreachable.unknown`) diff --git a/libs/feature/record/src/lib/state/mdview.facade.ts b/libs/feature/record/src/lib/state/mdview.facade.ts index 5cba2dad36..135d4be9b3 100644 --- a/libs/feature/record/src/lib/state/mdview.facade.ts +++ b/libs/feature/record/src/lib/state/mdview.facade.ts @@ -106,8 +106,9 @@ export class MdViewFacade { ) { return from(this.dataService.getItemsFromOgcApi(link.url.href)).pipe( map((collectionRecords: OgcApiRecord) => { - const hasGeometry = collectionRecords.geometry - return hasGeometry ? link : null + return collectionRecords && collectionRecords.geometry + ? link + : null }), defaultIfEmpty(null) )