2016-03-14 22:22:24 +00:00
|
|
|
import { createStore, applyMiddleware, compose } from 'redux';
|
|
|
|
import thunk from 'redux-thunk';
|
2017-06-21 06:40:28 +00:00
|
|
|
import createReducer from 'state';
|
2018-04-05 19:13:32 +00:00
|
|
|
import { routeReducer, routeMiddleware } from 'utils/router';
|
2017-06-06 22:04:37 +00:00
|
|
|
import message from './middleware/message';
|
2017-05-26 06:20:00 +00:00
|
|
|
import createSocketMiddleware from './middleware/socket';
|
|
|
|
import commands from './commands';
|
2016-03-14 22:22:24 +00:00
|
|
|
|
2017-05-07 20:19:15 +00:00
|
|
|
export default function configureStore(socket) {
|
2017-04-30 00:21:36 +00:00
|
|
|
// eslint-disable-next-line no-underscore-dangle
|
|
|
|
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
|
|
|
|
2017-05-07 20:19:15 +00:00
|
|
|
const reducer = createReducer(routeReducer);
|
|
|
|
|
|
|
|
const store = createStore(reducer, composeEnhancers(
|
2016-03-14 22:22:24 +00:00
|
|
|
applyMiddleware(
|
|
|
|
thunk,
|
2017-06-06 22:04:37 +00:00
|
|
|
routeMiddleware,
|
2016-03-14 22:22:24 +00:00
|
|
|
createSocketMiddleware(socket),
|
2017-06-06 22:04:37 +00:00
|
|
|
message,
|
2016-03-14 22:22:24 +00:00
|
|
|
commands
|
2017-04-30 00:21:36 +00:00
|
|
|
)
|
|
|
|
));
|
2017-05-07 20:19:15 +00:00
|
|
|
|
|
|
|
return store;
|
2015-12-28 23:34:32 +00:00
|
|
|
}
|