mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 12:21:13 +00:00
Fix getQueryString (#2558)
Browsers without size property for URLSearchParams always returned an empty string. Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
This commit is contained in:
parent
3bcb12eff9
commit
b1604e9c9f
1 changed files with 3 additions and 2 deletions
|
@ -5,8 +5,9 @@ export default function getQueryString<
|
||||||
Object.entries(obj)
|
Object.entries(obj)
|
||||||
.filter(([, val]) => val !== undefined && val !== null)
|
.filter(([, val]) => val !== undefined && val !== null)
|
||||||
.forEach(([key, val]) => searchParams.set(key, val ?? ""));
|
.forEach(([key, val]) => searchParams.set(key, val ?? ""));
|
||||||
if (searchParams.size) {
|
const params = searchParams.toString();
|
||||||
return "?" + searchParams.toString();
|
if (params) {
|
||||||
|
return "?" + params;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue