2016-02-25 00:45:56 -08:00
|
|
|
import { createStore, applyMiddleware, combineReducers, compose } from 'redux';
|
|
|
|
import thunkMiddleware from 'redux-thunk';
|
2016-07-15 15:05:04 -03:00
|
|
|
import { routerReducer } from 'react-router-redux';
|
2016-06-10 00:16:01 -03:00
|
|
|
import reducers from '../reducers';
|
2016-02-25 00:45:56 -08:00
|
|
|
|
|
|
|
const reducer = combineReducers({
|
2016-06-10 00:16:01 -03:00
|
|
|
...reducers,
|
2016-07-15 15:05:04 -03:00
|
|
|
routing: routerReducer
|
2016-02-25 00:45:56 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
const createStoreWithMiddleware = compose(
|
2016-07-15 15:05:04 -03:00
|
|
|
applyMiddleware(thunkMiddleware),
|
2016-02-25 00:45:56 -08:00
|
|
|
window.devToolsExtension ? window.devToolsExtension() : (f) => f
|
|
|
|
)(createStore);
|
|
|
|
|
|
|
|
export default (initialState) => (
|
|
|
|
createStoreWithMiddleware(reducer, initialState)
|
|
|
|
);
|