From 8b178a035a193dfeec553d308e636f477aa8829f Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Tue, 14 May 2024 11:06:30 +0200 Subject: [PATCH] Refactor Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- src/routes/handlers/fetchPatient.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/routes/handlers/fetchPatient.ts b/src/routes/handlers/fetchPatient.ts index 791b7b3..6fa965c 100644 --- a/src/routes/handlers/fetchPatient.ts +++ b/src/routes/handlers/fetchPatient.ts @@ -25,14 +25,7 @@ const { export const fetchPatientByQuery = async ( query: object ): Promise => { - const params = Object.entries(query); - let combinedParams = ''; - - if (params.length > 0) { - combinedParams = params - .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`) - .join('&'); - } + const combinedParams = new URLSearchParams(query as Record).toString(); const headers: HeadersInit = { 'Content-Type': 'application/fhir+json',