From 159de6527ced0b8af2815ae1ac8b21003dfdccc7 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 9 Jan 2018 22:49:59 +0100 Subject: [PATCH] Now checks the return status for if it was a success or not. --- client/app/components/admin/PirateSearch.jsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/client/app/components/admin/PirateSearch.jsx b/client/app/components/admin/PirateSearch.jsx index c60e7c2..5ed6abb 100644 --- a/client/app/components/admin/PirateSearch.jsx +++ b/client/app/components/admin/PirateSearch.jsx @@ -44,10 +44,16 @@ class PirateSearch extends Component { fetchJSON('https://apollo.kevinmidboe.com/api/v1/pirate/search?query='+query+'&type='+type, 'GET') // fetchJSON('http://localhost:31459/api/v1/pirate/search?query='+query+'&type='+type, 'GET') .then((response) => { - this.setState({ - torrentResponse: response.torrents, - loading: null, - }) + console.log('this is the first response: ', response) + if (response.success === true) { + this.setState({ + torrentResponse: response.torrents, + loading: null, + }) + } + elseĀ { + console.error(response.message) + } }) .catch((error) => { console.error(error);