Fixing session and logout errors
Этот коммит содержится в:
@@ -27,7 +27,9 @@ export default class Login extends React.Component {
|
|||||||
this.preSubmit = this.preSubmit.bind(this);
|
this.preSubmit = this.preSubmit.bind(this);
|
||||||
this.submit = this.submit.bind(this);
|
this.submit = this.submit.bind(this);
|
||||||
|
|
||||||
this.state = this.getStateFromStores();
|
const state = this.getStateFromStores();
|
||||||
|
state.doneCheckLogin = false;
|
||||||
|
this.state = state;
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
TeamStore.addChangeListener(this.onTeamChange);
|
TeamStore.addChangeListener(this.onTeamChange);
|
||||||
@@ -44,8 +46,7 @@ export default class Login extends React.Component {
|
|||||||
}
|
}
|
||||||
getStateFromStores() {
|
getStateFromStores() {
|
||||||
return {
|
return {
|
||||||
currentTeam: TeamStore.getByName(this.props.params.team),
|
currentTeam: TeamStore.getByName(this.props.params.team)
|
||||||
doneCheckLogin: false
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
onTeamChange() {
|
onTeamChange() {
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ function preLoggedIn(nextState, replace, callback) {
|
|||||||
|
|
||||||
const d2 = AsyncClient.getChannels();
|
const d2 = AsyncClient.getChannels();
|
||||||
|
|
||||||
|
ErrorStore.clearLastError();
|
||||||
|
|
||||||
$.when(d1, d2).done(() => {
|
$.when(d1, d2).done(() => {
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ class ErrorStoreClass extends EventEmitter {
|
|||||||
clearLastError() {
|
clearLastError() {
|
||||||
BrowserStore.removeGlobalItem('last_error');
|
BrowserStore.removeGlobalItem('last_error');
|
||||||
BrowserStore.removeGlobalItem('last_error_conn');
|
BrowserStore.removeGlobalItem('last_error_conn');
|
||||||
|
this.emitChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,12 +50,8 @@ function handleError(methodName, xhr, status, err) {
|
|||||||
track('api', 'api_weberror', methodName, 'message', msg);
|
track('api', 'api_weberror', methodName, 'message', msg);
|
||||||
|
|
||||||
if (xhr.status === 401) {
|
if (xhr.status === 401) {
|
||||||
if (window.location.href.indexOf('/channels') === 0) {
|
const team = window.location.pathname.split('/')[1];
|
||||||
browserHistory.push('/login?extra=expired&redirect=' + encodeURIComponent(window.location.pathname + window.location.search));
|
browserHistory.push('/' + team + '/login?extra=expired&redirect=' + encodeURIComponent(window.location.pathname + window.location.search));
|
||||||
} else {
|
|
||||||
var teamURL = window.location.pathname.split('/channels')[0];
|
|
||||||
browserHistory.push(teamURL + '/login?extra=expired&redirect=' + encodeURIComponent(window.location.pathname + window.location.search));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user