mirror of
https://github.com/caprover/caprover
synced 2026-05-29 23:00:54 +00:00
UploadAppData error state handled
This commit is contained in:
@@ -85,12 +85,14 @@ export default class HttpClient {
|
||||
return new Promise(function(resolve, reject) {
|
||||
// data.data here is the "data" field inside the API response! {status: 100, description: "Login succeeded", data: {…}}
|
||||
if (!self.isDestroyed) return resolve(data.data);
|
||||
Logger.dev("Destroyed then not called");
|
||||
});
|
||||
})
|
||||
.catch(function(error) {
|
||||
Logger.error(error);
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (!self.isDestroyed) return reject(error);
|
||||
Logger.dev("Destroyed catch not called");
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@ export default class BuildLogsView extends ApiComponent<
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (super.componentWillMount) super.componentWillMount();
|
||||
if (this.fetchBuildLogsInterval) {
|
||||
clearInterval(this.fetchBuildLogsInterval);
|
||||
}
|
||||
|
||||
@@ -52,17 +52,25 @@ export default class TarUploader extends ApiComponent<
|
||||
startUploadAndDeploy() {
|
||||
const self = this;
|
||||
|
||||
const file = self.state.fileToBeUploaded!;
|
||||
self.setState({ fileToBeUploaded: undefined });
|
||||
message.info("Upload has started");
|
||||
|
||||
Promise.resolve()
|
||||
.then(function() {
|
||||
return self.apiManager.uploadAppData(
|
||||
self.props.appName,
|
||||
self.state.fileToBeUploaded!.originFileObj!
|
||||
file.originFileObj!
|
||||
);
|
||||
})
|
||||
.then(function() {
|
||||
self.props.onUploadSucceeded();
|
||||
})
|
||||
.catch(Toaster.createCatcher());
|
||||
.catch(
|
||||
Toaster.createCatcher(function() {
|
||||
self.setState({ fileToBeUploaded: file });
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -44,6 +44,7 @@ export default class OneClickAppConfigPage extends Component<
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (super.componentWillMount) super.componentWillMount();
|
||||
this.isUnmount = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ export default class LoadBalancerStats extends ApiComponent<
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (super.componentWillMount) super.componentWillMount();
|
||||
if (this.updateApiInterval) {
|
||||
clearInterval(this.updateApiInterval);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user