1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-27 23:56:18 +00:00

don't turn to login page when 403 (#4323)

* don't turn to login page when 403

* [403] show login tip when 403 is returned
This commit is contained in:
llj
2019-12-05 15:45:16 +08:00
committed by Daniel Pan
parent ca794f934f
commit 7d7dc51821
86 changed files with 388 additions and 1397 deletions

View File

@@ -1,7 +1,7 @@
import React, { Component, Fragment } from 'react';
import { Button } from 'reactstrap';
import { seafileAPI } from '../../../utils/seafile-api';
import { siteRoot, loginUrl, gettext } from '../../../utils/constants';
import { siteRoot, gettext } from '../../../utils/constants';
import toaster from '../../../components/toast';
import { Utils } from '../../../utils/utils';
import EmptyTip from '../../../components/empty-tip';
@@ -110,25 +110,10 @@ class DeviceErrors extends Component {
isCleanBtnShown: res.data.length > 0
});
}).catch((error) => {
if (error.response) {
if (error.response.status == 403) {
this.setState({
loading: false,
errorMsg: gettext('Permission denied')
});
location.href = `${loginUrl}?next=${encodeURIComponent(location.href)}`;
} else {
this.setState({
loading: false,
errorMsg: gettext('Error')
});
}
} else {
this.setState({
loading: false,
errorMsg: gettext('Please check the network.')
});
}
this.setState({
loading: false,
errorMsg: Utils.getErrorMsg(error, true) // true: show login tip if 403
});
});
}