diff --git a/client/utils/use_api.js b/client/utils/use_api.js index aab0293..d167e02 100644 --- a/client/utils/use_api.js +++ b/client/utils/use_api.js @@ -10,12 +10,16 @@ export class Api { authToken = null; makeRequest(url, method, body) { + const options = {}; + if (method === 'POST' || method === 'PUT') { + options.body = JSON.stringify(body); + } return fetch(url, { method, headers: { Authorization: `Bearer ${this.authToken}`, }, - body, + ...options, }).then((res) => res.json()); }