mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-28 08:06:56 +00:00
@@ -9,7 +9,6 @@ import { Utils } from '../../utils/utils';
|
||||
import UploadLink from '../../models/upload-link';
|
||||
import toaster from '../toast';
|
||||
import SendLink from '../send-link';
|
||||
import SessionExpiredTip from '../session-expired-tip';
|
||||
|
||||
const propTypes = {
|
||||
itemPath: PropTypes.string.isRequired,
|
||||
@@ -45,13 +44,11 @@ class GenerateUploadLink extends React.Component {
|
||||
this.setState({sharedUploadInfo: sharedUploadInfo});
|
||||
}
|
||||
}).catch((err) => {
|
||||
if (err.response.status === 403) {
|
||||
toaster.danger(
|
||||
<SessionExpiredTip />,
|
||||
{id: 'session_expired', duration: 3600}
|
||||
);
|
||||
this.props.closeShareDialog();
|
||||
let errMsg = Utils.getErrorMsg(err, true);
|
||||
if (!err.response || err.response.status !== 403) {
|
||||
toaster.danger(errMsg);
|
||||
}
|
||||
this.props.closeShareDialog();
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -2,10 +2,12 @@ import React from 'react';
|
||||
import { gettext, loginUrl } from '../utils/constants';
|
||||
|
||||
function PermissionDeniedTip() {
|
||||
let reloginUrl = `${loginUrl}?next=${encodeURIComponent(location.href)}`;
|
||||
let errorTip = gettext('Permission denied. Plaese try {placeholder-left}login again.{placeholder-right}');
|
||||
errorTip = errorTip.replace('{placeholder-left}', '<a class="action-link p-0" href='+ reloginUrl + '>')
|
||||
errorTip = errorTip.replace('{placeholder-right}', '</a>');
|
||||
return(
|
||||
<span className="error">{gettext('Permission denied. Please try')}{' '}
|
||||
<a className="action-link p-0" href={`${loginUrl}?next=${encodeURIComponent(location.href)}`}>{gettext('login again.')}</a>
|
||||
</span>
|
||||
<span className="error" dangerouslySetInnerHTML={{__html: errorTip}}></span>
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -1,12 +0,0 @@
|
||||
import React from 'react';
|
||||
import { gettext, loginUrl } from '../utils/constants';
|
||||
|
||||
function SessionExpiredTip() {
|
||||
return(
|
||||
<span className="error">{gettext('You are logged out.')}{' '}
|
||||
<a className="action-link p-0" href={`${loginUrl}?next=${encodeURIComponent(location.href)}`}>{gettext('Login again.')}</a>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export default SessionExpiredTip;
|
Reference in New Issue
Block a user