#6555 refactor to js #28

Merged
jorgep merged 13 commits from 6555-refactorToJs into test 2024-10-10 13:51:47 +00:00
1 changed files with 2 additions and 3 deletions
Showing only changes of commit 76411063ba - Show all commits

View File

@ -77,9 +77,8 @@ async function call(url, { method = "GET", body = {}, params = {} }) {
if (method === "GET") { if (method === "GET") {
const searchParams = new URLSearchParams(); const searchParams = new URLSearchParams();
for (let key in params) { for (let [key, value] of Object.entries(params)) {
if (params.hasOwnProperty(key) && typeof params[key] === "object") searchParams.append(key, JSON.stringify(params[key])); searchParams.append(key, typeof value === "object" ? JSON.stringify(value) : value);
else searchParams.append(key, params[key]);
} }
url += "?" + searchParams.toString(); url += "?" + searchParams.toString();