Fixed: use correct comparison of body in makeFetch

This commit is contained in:
Julien Fastré 2022-12-23 11:32:31 +01:00
parent 4da9b6587d
commit f12f640cb4
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -67,13 +67,18 @@ export const makeFetch = <Input, Output>(method: 'POST'|'GET'|'PUT'|'PATCH'|'DEL
},
};
if (body !== null || typeof body !== 'undefined') {
console.log('for url '+url, body);
console.log('for url '+url, body !== null);
if (body !== null && typeof body !== 'undefined') {
Object.assign(opts, {body: JSON.stringify(body)})
}
if (typeof options !== 'undefined') {
opts = Object.assign(opts, options);
}
console.log('will fetch', url);
console.log('content for ' + url, opts);
return fetch(url, opts)
.then(response => {