mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Fix error handling on AJAX request
This commit is contained in:
parent
3c3504d773
commit
97abafda0d
@ -54,11 +54,16 @@ let ShareForm = React.createClass({
|
||||
},
|
||||
body: JSON.stringify(this.getFormData())
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status >= 200 && response.status < 300)
|
||||
return response
|
||||
throw new Error(response.statusText)
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.catch(function(error) {
|
||||
.catch((error) => {
|
||||
this.setState({errors: error});
|
||||
console.log('request failed', error);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
//.then(FetchApiUtils.status)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user