From e6dac46bfd3abdf14d600bf0797690a7aff9ed9d Mon Sep 17 00:00:00 2001 From: Paulo Date: Mon, 15 Nov 2021 13:00:39 +0000 Subject: [PATCH] Prevent empty strings / arrays from passing filter (#19) * Prevent empty strings / arrays from passing filter * Update src/utils/objectToUrlParams.ts Co-authored-by: John Richard Chipps-Harding Co-authored-by: John Richard Chipps-Harding --- src/utils/objectToUrlParams.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/objectToUrlParams.ts b/src/utils/objectToUrlParams.ts index fb6a3d3..49da4a3 100644 --- a/src/utils/objectToUrlParams.ts +++ b/src/utils/objectToUrlParams.ts @@ -4,7 +4,7 @@ interface UrlDataProps { export default function objectToUrlParams(data: UrlDataProps) { const params = Object.entries(data) - .filter(([, value]) => value !== undefined && value !== null) + .filter(([, value]) => value) .map( ([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`