From 187f710739b673dc3ffb6f049f79b8c5f5875692 Mon Sep 17 00:00:00 2001 From: Terry van Walen Date: Thu, 19 Dec 2024 13:11:27 +0100 Subject: [PATCH] Exclude empty params in decosUrlParams in getZakenByUserKey --- src/server/services/decos/decos-service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server/services/decos/decos-service.ts b/src/server/services/decos/decos-service.ts index baf784d47..e27d6cc64 100644 --- a/src/server/services/decos/decos-service.ts +++ b/src/server/services/decos/decos-service.ts @@ -309,11 +309,11 @@ async function getZakenByUserKey( .map((transformer) => `${caseField} eq ${transformer.caseType}`) .join(' or '); - const decosUrlParams = [ - 'top=50', - fields ? `select=${fields}` : '', - caseTypes ? `filter=${caseTypes}` : '', - ].join('&'); + const decosUrlParams = new URLSearchParams({ + top: '50', + ...(fields && { select: fields }), + ...(caseTypes && { filter: caseTypes }), + }); const apiConfig = getApiConfig('DECOS_API', { formatUrl: (config) => {