diff --git a/src/api.js b/src/api.js index 3367890..a2e9913 100644 --- a/src/api.js +++ b/src/api.js @@ -14,10 +14,16 @@ async function api(baseUrl, config, method, params) { if (Array.isArray(data)) { data = JSON.stringify(data); } + if (data === null || typeof data === 'undefined') { + return; + } options.body.append(key, data); }); } else if (params) { Object.entries(params).forEach(([key, value]) => { + if (value === null || typeof value === 'undefined') { + return; + } url.searchParams.append(key, value); }); }