canape/frontend/js/store.js
Grégoire Delattre c5cafacbf1 Update everything to work with the new router
By the way, remove the router state from redux.
2019-05-19 02:31:25 +02:00

29 lines
589 B
JavaScript

import { createHashHistory } from "history";
import { createStore, applyMiddleware, compose } from "redux";
import thunk from "redux-thunk";
export const history = createHashHistory();
import rootReducer from "./reducers/index";
const middlewares = [thunk];
// Only use in development mode (set in webpack)
if (process.env.NODE_ENV === "development") {
const { logger } = require("redux-logger");
middlewares.push(logger);
}
// Export the store
const store = createStore(
rootReducer,
compose(
applyMiddleware(
...middlewares,
),
),
);
export default store;