From 57369a7c8c1f9706659e1cacbfa3e201d9f2bc84 Mon Sep 17 00:00:00 2001 From: Eshank Vaish Date: Thu, 8 Feb 2024 12:56:13 +0530 Subject: [PATCH] feat: add support for array in search params --- package-lock.json | 4 ++-- package.json | 2 +- src/Common/Helper.tsx | 9 ++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 97e9f0776..cfc0b47df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "0.0.61-beta-4", + "version": "0.0.61-beta-8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "0.0.61-beta-4", + "version": "0.0.61-beta-8", "license": "ISC", "dependencies": { "fast-json-patch": "^3.1.1", diff --git a/package.json b/package.json index c0bc70233..2ce126131 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devtron-labs/devtron-fe-common-lib", - "version": "0.0.61-beta-4", + "version": "0.0.61-beta-8", "description": "Supporting common component library", "main": "dist/index.js", "scripts": { diff --git a/src/Common/Helper.tsx b/src/Common/Helper.tsx index 7baf0dad6..329c68efd 100644 --- a/src/Common/Helper.tsx +++ b/src/Common/Helper.tsx @@ -447,9 +447,16 @@ export const processDeployedTime = (lastDeployed, isArgoInstalled) => { */ export const getUrlWithSearchParams = (url: string, params: Record) => { const searchParams = new URLSearchParams() + // TODO: Common out Object.keys(params).forEach((key) => { if (params[key]) { - searchParams.append(key, params[key]) + if (Array.isArray(params[key])) { + params[key].forEach((val) => { + searchParams.append(key, val) + }) + } else { + searchParams.set(key, params[key]) + } } }) const queryString = searchParams.toString()