mattermost-mobile/service/reducers/requests/general.js
enahum 7e426b6029 Add WebSocket support (#144)
* Add WebSocket support

* fix unit tests

* Add actions to websocket and fix unit tests
2016-12-21 12:54:23 -05:00

53 lines
1.3 KiB
JavaScript

// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {combineReducers} from 'redux';
import {GeneralTypes} from 'service/constants';
import {handleRequest, initialRequestState} from './helpers';
function server(state = initialRequestState(), action) {
return handleRequest(
GeneralTypes.PING_REQUEST,
GeneralTypes.PING_SUCCESS,
GeneralTypes.PING_FAILURE,
state,
action
);
}
function config(state = initialRequestState(), action) {
return handleRequest(
GeneralTypes.CLIENT_CONFIG_REQUEST,
GeneralTypes.CLIENT_CONFIG_SUCCESS,
GeneralTypes.CLIENT_CONFIG_FAILURE,
state,
action
);
}
function license(state = initialRequestState(), action) {
return handleRequest(
GeneralTypes.CLIENT_LICENSE_REQUEST,
GeneralTypes.CLIENT_LICENSE_SUCCESS,
GeneralTypes.CLIENT_LICENSE_FAILURE,
state,
action
);
}
function websocket(state = initialRequestState(), action) {
return handleRequest(
GeneralTypes.WEBSOCKET_REQUEST,
GeneralTypes.WEBSOCKET_SUCCESS,
GeneralTypes.WEBSOCKET_FAILURE,
state,
action
);
}
export default combineReducers({
server,
config,
license,
websocket
});