Now checks the return status for if it was a success or not.
This commit is contained in:
@@ -44,10 +44,16 @@ class PirateSearch extends Component {
|
|||||||
fetchJSON('https://apollo.kevinmidboe.com/api/v1/pirate/search?query='+query+'&type='+type, 'GET')
|
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')
|
// fetchJSON('http://localhost:31459/api/v1/pirate/search?query='+query+'&type='+type, 'GET')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
console.log('this is the first response: ', response)
|
||||||
|
if (response.success === true) {
|
||||||
this.setState({
|
this.setState({
|
||||||
torrentResponse: response.torrents,
|
torrentResponse: response.torrents,
|
||||||
loading: null,
|
loading: null,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.error(response.message)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user