mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +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:
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
||||
import moment from 'moment';
|
||||
import cookie from 'react-cookies';
|
||||
import { Link } from '@reach/router';
|
||||
import { gettext, siteRoot, loginUrl, isPro } from '../../utils/constants';
|
||||
import { gettext, siteRoot, isPro } from '../../utils/constants';
|
||||
import { seafileAPI } from '../../utils/seafile-api';
|
||||
import { Utils } from '../../utils/utils';
|
||||
import toaster from '../../components/toast';
|
||||
@@ -328,26 +328,10 @@ class SharedLibraries extends Component {
|
||||
items: Utils.sortRepos(repoList, this.state.sortBy, this.state.sortOrder)
|
||||
});
|
||||
}).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
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user