Commit a16174e2 authored by tom's avatar tom

fix api fetch query falsy params

parent 60090f29
...@@ -18,8 +18,8 @@ export default function buildUrl<R extends ResourceName>( ...@@ -18,8 +18,8 @@ export default function buildUrl<R extends ResourceName>(
const url = new URL(compile(path)(pathParams), baseUrl); const url = new URL(compile(path)(pathParams), baseUrl);
queryParams && Object.entries(queryParams).forEach(([ key, value ]) => { queryParams && Object.entries(queryParams).forEach(([ key, value ]) => {
// there are some pagination params that can be null for the next page // there are some pagination params that can be null or false for the next page
(value || value === null) && url.searchParams.append(key, String(value)); value !== undefined && value !== '' && url.searchParams.append(key, String(value));
}); });
return url.toString(); return url.toString();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment