mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fix console errors when logging out (#4915)
This commit is contained in:
committed by
Christopher Speller
parent
5811acca7f
commit
20b9954424
@@ -15,6 +15,8 @@ import SearchStore from 'stores/search_store.jsx';
|
||||
import {handleNewPost, loadPosts, loadPostsBefore, loadPostsAfter} from 'actions/post_actions.jsx';
|
||||
import {loadProfilesAndTeamMembersForDMSidebar} from 'actions/user_actions.jsx';
|
||||
import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx';
|
||||
import {stopPeriodicStatusUpdates} from 'actions/status_actions.jsx';
|
||||
import * as WebsocketActions from 'actions/websocket_actions.jsx';
|
||||
|
||||
import Constants from 'utils/constants.jsx';
|
||||
const ActionTypes = Constants.ActionTypes;
|
||||
@@ -480,6 +482,8 @@ export function emitUserLoggedOutEvent(redirectTo = '/', shouldSignalLogout = tr
|
||||
UserStore.clear();
|
||||
TeamStore.clear();
|
||||
newLocalizationSelected(global.window.mm_config.DefaultClientLocale);
|
||||
stopPeriodicStatusUpdates();
|
||||
WebsocketActions.close();
|
||||
browserHistory.push(redirectTo);
|
||||
},
|
||||
() => {
|
||||
|
||||
@@ -59,7 +59,6 @@ export function initialize() {
|
||||
|
||||
WebSocketClient.setEventCallback(handleEvent);
|
||||
WebSocketClient.setFirstConnectCallback(handleFirstConnect);
|
||||
WebSocketClient.setReconnectCallback(handleReconnect);
|
||||
WebSocketClient.setCloseCallback(handleClose);
|
||||
WebSocketClient.initialize(connUrl);
|
||||
}
|
||||
@@ -71,21 +70,18 @@ export function close() {
|
||||
export function reconnect() {
|
||||
close();
|
||||
initialize();
|
||||
handleReconnect();
|
||||
}
|
||||
|
||||
function handleFirstConnect() {
|
||||
if (Client.teamId) {
|
||||
loadChannelsForCurrentUser();
|
||||
loadPosts(ChannelStore.getCurrentId());
|
||||
StatusActions.loadStatusesForChannelAndSidebar();
|
||||
}
|
||||
|
||||
ErrorStore.clearLastError();
|
||||
ErrorStore.emitChange();
|
||||
}
|
||||
|
||||
function handleReconnect() {
|
||||
if (Client.teamId) {
|
||||
loadChannelsForCurrentUser();
|
||||
loadPosts(ChannelStore.getCurrentId());
|
||||
}
|
||||
|
||||
StatusActions.loadStatusesForChannelAndSidebar();
|
||||
function handleFirstConnect() {
|
||||
ErrorStore.clearLastError();
|
||||
ErrorStore.emitChange();
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ export default class AdminNavbarDropdown extends React.Component {
|
||||
<li>
|
||||
<a
|
||||
href='#'
|
||||
onClick={GlobalActions.emitUserLoggedOutEvent}
|
||||
onClick={() => GlobalActions.emitUserLoggedOutEvent()}
|
||||
>
|
||||
<FormattedMessage
|
||||
id='admin.nav.logout'
|
||||
|
||||
@@ -203,7 +203,7 @@ export default class SelectTeam extends React.Component {
|
||||
headerButton = (
|
||||
<a
|
||||
href='#'
|
||||
onClick={GlobalActions.emitUserLoggedOutEvent}
|
||||
onClick={() => GlobalActions.emitUserLoggedOutEvent()}
|
||||
>
|
||||
<span className='fa fa-chevron-left'/>
|
||||
<FormattedMessage id='web.header.logout'/>
|
||||
|
||||
@@ -477,7 +477,7 @@ export default class SidebarHeaderDropdown extends React.Component {
|
||||
<li>
|
||||
<a
|
||||
href='#'
|
||||
onClick={GlobalActions.emitUserLoggedOutEvent}
|
||||
onClick={() => GlobalActions.emitUserLoggedOutEvent()}
|
||||
>
|
||||
<FormattedMessage
|
||||
id='navbar_dropdown.logout'
|
||||
|
||||
@@ -442,7 +442,7 @@ export default class SidebarRightMenu extends React.Component {
|
||||
<li>
|
||||
<a
|
||||
href='#'
|
||||
onClick={GlobalActions.emitUserLoggedOutEvent}
|
||||
onClick={() => GlobalActions.emitUserLoggedOutEvent()}
|
||||
>
|
||||
<i className='icon fa fa-sign-out'/>
|
||||
<FormattedMessage
|
||||
|
||||
Reference in New Issue
Block a user