Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #54 from mattermost/ws-m
Browse files Browse the repository at this point in the history
Change closed websocket action type (master)
  • Loading branch information
jwilander authored and hmhealey committed Aug 28, 2020
1 parent 649df21 commit fce3857
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/mattermost-redux/src/action_types/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ export default keyMirror({

WEBSOCKET_REQUEST: null,
WEBSOCKET_SUCCESS: null,
WEBSOCKET_FAILURE: null
WEBSOCKET_FAILURE: null,
WEBSOCKET_CLOSED: null
});
2 changes: 1 addition & 1 deletion packages/mattermost-redux/src/actions/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function close() {
return async (dispatch, getState) => {
websocketClient.close(true);
if (dispatch) {
dispatch({type: GeneralTypes.WEBSOCKET_FAILURE, error: 'Closed'}, getState);
dispatch({type: GeneralTypes.WEBSOCKET_CLOSED}, getState);
}
};
}
Expand Down
4 changes: 4 additions & 0 deletions packages/mattermost-redux/src/reducers/requests/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ function license(state = initialRequestState(), action) {
}

function websocket(state = initialRequestState(), action) {
if (action.type === GeneralTypes.WEBSOCKET_CLOSED) {
return initialRequestState();
}

return handleRequest(
GeneralTypes.WEBSOCKET_REQUEST,
GeneralTypes.WEBSOCKET_SUCCESS,
Expand Down

0 comments on commit fce3857

Please sign in to comment.