Commit 037078d6 authored by Ray Schamp's avatar Ray Schamp

Avoid displaying an error when /news returns a 500

This situation probably occurs most frequently when running dev servers while offline, but could also happen if the API is having issues. 500 responses from the API should not take down the homepage so drastically, and are also sometimes unavoidable while working offline.
parent 6d8235c7
......@@ -71,7 +71,10 @@ class Splash extends React.Component {
getNews () {
api({
uri: '/news?limit=3'
}, (err, body) => {
}, (err, body, resp) => {
if (resp.statusCode !== 200) {
return log.error(`Unexpected status code ${resp.statusCode} received from news request`);
}
if (!body) return log.error('No response body');
if (!err) return this.setState({news: body});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment