dispatch/client/src/js/store/index.js

25 lines
725 B
JavaScript
Raw Normal View History

2016-03-14 22:22:24 +00:00
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import createReducer from '../reducers';
import { routeReducer, routeMiddleware } from '../util/router';
2016-03-14 22:22:24 +00:00
import createSocketMiddleware from '../middleware/socket';
import commands from '../commands';
export default function configureStore(socket) {
// eslint-disable-next-line no-underscore-dangle
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const reducer = createReducer(routeReducer);
const store = createStore(reducer, composeEnhancers(
2016-03-14 22:22:24 +00:00
applyMiddleware(
routeMiddleware,
2016-03-14 22:22:24 +00:00
thunk,
createSocketMiddleware(socket),
commands
)
));
return store;
2015-12-28 23:34:32 +00:00
}