Fix a bug which crashes the site when there is no internet connection
In case there is no internet connection axios will not return a response object with the error after a request. Since we still tried to access said object the website crashed when there was no internet connection.
This commit is contained in:
parent
6035da058e
commit
45136aa1d6
|
|
@ -392,7 +392,11 @@ class Main extends React.Component {
|
|||
this.setState({ status : response.status, tournament : convertTournament(response.data)});
|
||||
})
|
||||
.catch((err) => {
|
||||
this.setState({ status : err.response.status });
|
||||
if(err.response) {
|
||||
this.setState({ status : err.response.status });
|
||||
} else {
|
||||
this.setState({ status : -1 });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue