From 2fd515d997cf13835131cd48968d8a15190c4d08 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sat, 21 Oct 2017 00:08:35 +0200 Subject: [PATCH] Fixed a bug where the json object was not being returned and fixed indentation of fetchJSON function. --- client/app/components/http.jsx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/client/app/components/http.jsx b/client/app/components/http.jsx index 63de148..8f4fbc5 100644 --- a/client/app/components/http.jsx +++ b/client/app/components/http.jsx @@ -15,7 +15,7 @@ import { getCookie } from './Cookie.jsx'; return response; } - function parseJSON(response) { response.json(); } + function parseJSON(response) { return response.json(); } @@ -41,12 +41,12 @@ import { getCookie } from './Cookie.jsx'; // export default http; export function fetchJSON(url, method, data) { - return fetch(url, { - method: method, - headers: new Headers({ - 'Content-Type': 'application/json', - 'authorization': getCookie('token'), - }), - body: JSON.stringify(data) - }).then(checkStatus).then(parseJSON); - } \ No newline at end of file + return fetch(url, { + method: method, + headers: new Headers({ + 'Content-Type': 'application/json', + 'authorization': getCookie('token'), + }), + body: JSON.stringify(data) + }).then(checkStatus).then(parseJSON); +} \ No newline at end of file