Disconnect the websocket on logout and connect appropiately (#2375)
This commit is contained in:
parent
7c711caf2d
commit
a03016a9e3
2 changed files with 8 additions and 1 deletions
|
|
@ -81,6 +81,10 @@ export default class NetworkIndicator extends PureComponent {
|
|||
this.mounted = true;
|
||||
|
||||
AppState.addEventListener('change', this.handleAppStateChange);
|
||||
|
||||
// Attempt to connect when this component mounts
|
||||
// if the websocket is already connected it does not try and connect again
|
||||
this.connect();
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
|
|
|
|||
|
|
@ -20,9 +20,11 @@ import {Provider} from 'react-redux';
|
|||
import semver from 'semver';
|
||||
|
||||
import {Client4} from 'mattermost-redux/client';
|
||||
import {General} from 'mattermost-redux/constants';
|
||||
import {setAppState, setServerVersion} from 'mattermost-redux/actions/general';
|
||||
import {loadMe, logout} from 'mattermost-redux/actions/users';
|
||||
import {close as closeWebSocket} from 'mattermost-redux/actions/websocket';
|
||||
import {General} from 'mattermost-redux/constants';
|
||||
|
||||
import {handleLoginIdChanged} from 'app/actions/views/login';
|
||||
import {handleServerUrlChanged} from 'app/actions/views/select_server';
|
||||
import EventEmitter from 'mattermost-redux/utils/event_emitter';
|
||||
|
|
@ -141,6 +143,7 @@ const handleLogout = () => {
|
|||
// the Client online flag to true cause the network handler
|
||||
// is not available at this point
|
||||
Client4.setOnline(true);
|
||||
store.dispatch(closeWebSocket(false));
|
||||
|
||||
app.setAppStarted(true);
|
||||
app.clearNativeCache();
|
||||
|
|
|
|||
Loading…
Reference in a new issue