From 76411063bad5f333276679d8bb59b2c69f7e50be Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 14 Jun 2024 17:06:27 +0200 Subject: [PATCH] feat: refs #6555 iron out url parms builder --- js/main.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/js/main.js b/js/main.js index 6b7804f..7d53778 100644 --- a/js/main.js +++ b/js/main.js @@ -77,9 +77,8 @@ async function call(url, { method = "GET", body = {}, params = {} }) { if (method === "GET") { const searchParams = new URLSearchParams(); - for (let key in params) { - if (params.hasOwnProperty(key) && typeof params[key] === "object") searchParams.append(key, JSON.stringify(params[key])); - else searchParams.append(key, params[key]); + for (let [key, value] of Object.entries(params)) { + searchParams.append(key, typeof value === "object" ? JSON.stringify(value) : value); } url += "?" + searchParams.toString();