mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
Merge pull request #2284 from rschamp/bugfix/offline-homepage
Avoid displaying an error when /news returns a 500
This commit is contained in:
commit
e2795ec4d6
1 changed files with 4 additions and 1 deletions
|
@ -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});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue