dispatch/client/js/store.js

31 lines
799 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 'state';
import { routeReducer, routeMiddleware } from 'utils/router';
import message from './middleware/message';
import createSocketMiddleware from './middleware/socket';
import commands from './commands';
2016-03-14 22:22:24 +00:00
export default function configureStore(socket) {
2018-04-05 23:46:22 +00:00
/* eslint-disable no-underscore-dangle */
const composeEnhancers =
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const reducer = createReducer(routeReducer);
2018-04-05 23:46:22 +00:00
const store = createStore(
reducer,
composeEnhancers(
applyMiddleware(
thunk,
routeMiddleware,
createSocketMiddleware(socket),
message,
commands
)
)
2018-04-05 23:46:22 +00:00
);
return store;
2015-12-28 23:34:32 +00:00
}