2018-07-04 16:43:46 +02:00
|
|
|
// @flow
|
|
|
|
|
import thunk from "redux-thunk";
|
|
|
|
|
import logger from "redux-logger";
|
|
|
|
|
import { createStore, compose, applyMiddleware, combineReducers } from "redux";
|
|
|
|
|
import { routerReducer, routerMiddleware } from "react-router-redux";
|
2018-07-02 14:50:13 +02:00
|
|
|
|
2018-07-04 16:43:46 +02:00
|
|
|
import users from "./users/modules/users";
|
2018-07-12 11:33:41 +02:00
|
|
|
import auth from "./modules/auth";
|
2018-07-02 14:50:13 +02:00
|
|
|
|
2018-07-05 16:48:56 +02:00
|
|
|
import type { BrowserHistory } from "history/createBrowserHistory";
|
2018-07-04 16:43:46 +02:00
|
|
|
|
|
|
|
|
function createReduxStore(history: BrowserHistory) {
|
2018-07-05 16:48:56 +02:00
|
|
|
const composeEnhancers =
|
|
|
|
|
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
2018-07-02 14:50:13 +02:00
|
|
|
|
|
|
|
|
const reducer = combineReducers({
|
|
|
|
|
router: routerReducer,
|
2018-07-05 16:48:56 +02:00
|
|
|
users,
|
2018-07-13 10:57:11 +02:00
|
|
|
auth
|
2018-07-02 14:50:13 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return createStore(
|
|
|
|
|
reducer,
|
|
|
|
|
composeEnhancers(applyMiddleware(routerMiddleware(history), thunk, logger))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default createReduxStore;
|