1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 08:53:14 +00:00

Improve response catch module (#3848)

* add err hanlder for dialog ajax request

* add error handler for component ajax request

* repair code bug

* repair code bug

* add handler for page ajax module
This commit is contained in:
杨顺强
2019-07-16 10:01:09 +08:00
committed by Daniel Pan
parent 957979254b
commit 04e791f14c
91 changed files with 813 additions and 327 deletions

View File

@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
import { gettext, fileServerRoot } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';
import Loading from '../loading';
const propTypes = {
@@ -43,12 +44,7 @@ class ZipDownloadDialog extends React.Component {
this.queryZipProgress();
interval = setInterval(this.queryZipProgress, 1000);
}).catch((error) => {
let errorMsg = '';
if (error.response) {
errorMsg = error.response.data.error_msg || gettext('Error');
} else {
errorMsg = gettext('Please check the network.');
}
let errorMsg = Utils.getErrorMsg(error);
this.setState({
isLoading: false,
errorMsg: errorMsg
@@ -70,12 +66,7 @@ class ZipDownloadDialog extends React.Component {
}
}).catch((error) => {
clearInterval(interval);
let errorMsg = '';
if (error.response) {
errorMsg = gettext('Error');
} else {
errorMsg = gettext('Please check the network.');
}
let errorMsg = Utils.getErrorMsg(error);
this.setState({
isLoading: false,
errorMsg: errorMsg