2016-02-25 00:45:56 -08:00
|
|
|
import { createStore, applyMiddleware, combineReducers, compose } from 'redux';
|
|
|
|
import thunkMiddleware from 'redux-thunk';
|
|
|
|
import { browserHistory } from 'react-router';
|
|
|
|
import { syncHistory, routeReducer } from 'react-router-redux';
|
2016-02-25 12:31:21 -08:00
|
|
|
import { auth } from '../reducers/auth';
|
2016-02-25 00:45:56 -08:00
|
|
|
import { config } from '../reducers/config';
|
2016-06-05 01:52:18 -07:00
|
|
|
import { entries } from '../reducers/entries';
|
2016-02-25 00:45:56 -08:00
|
|
|
import { collections } from '../reducers/collections';
|
|
|
|
|
|
|
|
const reducer = combineReducers({
|
2016-02-25 12:31:21 -08:00
|
|
|
auth,
|
2016-02-25 00:45:56 -08:00
|
|
|
config,
|
|
|
|
collections,
|
2016-06-05 01:52:18 -07:00
|
|
|
entries,
|
2016-02-25 00:45:56 -08:00
|
|
|
router: routeReducer
|
|
|
|
});
|
|
|
|
|
|
|
|
const createStoreWithMiddleware = compose(
|
|
|
|
applyMiddleware(thunkMiddleware, syncHistory(browserHistory)),
|
|
|
|
window.devToolsExtension ? window.devToolsExtension() : (f) => f
|
|
|
|
)(createStore);
|
|
|
|
|
|
|
|
export default (initialState) => (
|
|
|
|
createStoreWithMiddleware(reducer, initialState)
|
|
|
|
);
|