From f12f640cb4316213f3686b1465bd1d114c729e51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 23 Dec 2022 11:32:31 +0100 Subject: [PATCH] Fixed: use correct comparison of body in makeFetch --- .../ChillMainBundle/Resources/public/lib/api/apiMethods.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.ts b/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.ts index d12871bdd..0ef659128 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/api/apiMethods.ts @@ -67,13 +67,18 @@ export const makeFetch = (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 => {