Merge pull request #2284 from rschamp/bugfix/offline-homepage

Avoid displaying an error when /news returns a 500
This commit is contained in:
Ray Schamp 2018-11-07 17:57:10 +00:00 committed by GitHub
commit e2795ec4d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,7 +71,10 @@ class Splash extends React.Component {
getNews () { getNews () {
api({ api({
uri: '/news?limit=3' 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 (!body) return log.error('No response body');
if (!err) return this.setState({news: body}); if (!err) return this.setState({news: body});
}); });