Drop map values that are undefined from API requests
This commit is contained in:
parent
94cff7c2c8
commit
98fb2ef0d8
|
@ -36,10 +36,9 @@ function nestedUrlSearchParams(data: any, topLevel: boolean = true): string {
|
|||
.map(encodeURIComponent)
|
||||
.join("&");
|
||||
|
||||
const inner = Object.entries(data).map(([k, v]) => [
|
||||
k,
|
||||
nestedUrlSearchParams(v, false),
|
||||
]);
|
||||
const inner = Object.entries(data)
|
||||
.filter(([_, v]) => typeof v !== "undefined")
|
||||
.map(([k, v]) => [k, nestedUrlSearchParams(v, false)]);
|
||||
|
||||
return new URLSearchParams(inner).toString();
|
||||
|
||||
|
|
Loading…
Reference in New Issue