From a86232d738a8dbf1381f2c8c56048e1ec7ab83d1 Mon Sep 17 00:00:00 2001 From: Ali Amori Kadhim Date: Tue, 17 Dec 2024 16:01:54 +0100 Subject: [PATCH] fix(overige-objecten-api): fix processData function --- .changeset/ten-steaks-cover.md | 5 +++++ apps/overige-objecten-api/src/utils/processData.tsx | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/ten-steaks-cover.md diff --git a/.changeset/ten-steaks-cover.md b/.changeset/ten-steaks-cover.md new file mode 100644 index 00000000..8c89c845 --- /dev/null +++ b/.changeset/ten-steaks-cover.md @@ -0,0 +1,5 @@ +--- +"@frameless/overige-objecten-api": patch +--- + +Los het probleem op dat optreedt wanneer er geen gegevens beschikbaar zijn in kennisartikelen. diff --git a/apps/overige-objecten-api/src/utils/processData.tsx b/apps/overige-objecten-api/src/utils/processData.tsx index 8bfb354b..9f5800ec 100644 --- a/apps/overige-objecten-api/src/utils/processData.tsx +++ b/apps/overige-objecten-api/src/utils/processData.tsx @@ -16,7 +16,7 @@ interface ProcessDataParams { } export const processData = ({ data, priceData }: ProcessDataParams) => - data.map((item: any) => { + data?.map((item: any) => { if (item.component === 'ComponentComponentsUtrechtRichText') { return mapContentByCategory( item.categorie, @@ -36,7 +36,7 @@ export const processData = ({ data, priceData }: ProcessDataParams) => return mappedContent; } if (item.component === 'ComponentComponentsUtrechtImage') { - const imageUrl = item.imageData.data.attributes.url; + const imageUrl = item?.imageData?.data?.attributes.url; if (!imageUrl) return {}; if (!item.categorie) return {};