Fix problem caused by unknown reasons
This commit is contained in:
parent
22347d894c
commit
6e0042d755
1 changed files with 7 additions and 2 deletions
|
@ -24,14 +24,19 @@ export default class ProjectImage extends React.Component {
|
||||||
})
|
})
|
||||||
}).then(function (response) {
|
}).then(function (response) {
|
||||||
if (response.status === 302) {
|
if (response.status === 302) {
|
||||||
this.setState({ url: response.json() });
|
|
||||||
return response;
|
return response;
|
||||||
} else {
|
} else {
|
||||||
var error = new Error(response.statusText);
|
var error = new Error(response.statusText);
|
||||||
error.response = response;
|
error.response = response;
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}.bind(this)).catch((e) => console.log(e));
|
}).then(
|
||||||
|
(response) => response.json()
|
||||||
|
).then(function (url) {
|
||||||
|
this.setState({ url });
|
||||||
|
}.bind(this)).catch(function (error) {
|
||||||
|
console.log("Got this error:", error);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
Reference in a new issue