Commit 8a3e6155 authored by Paul Kaplan's avatar Paul Kaplan

Separate helper for creating the default redux store for www pages

parent b3795c94
const redux = require('redux');
const thunk = require('redux-thunk').default;
const reducer = require('../redux/reducer.js');
const configureStore = (reducers, initialState, enhancer) => {
const allReducers = reducer(reducers);
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || redux.compose;
const enhancers = enhancer ?
composeEnhancers(
redux.applyMiddleware(thunk),
enhancer
) :
composeEnhancers(
redux.applyMiddleware(thunk)
);
const store = redux.createStore(
allReducers,
initialState || {},
enhancers
);
return store;
};
module.exports = configureStore;
const redux = require('redux');
const thunk = require('redux-thunk').default;
// JSX syntax transforms to React.createElement
const React = require('react'); // eslint-disable-line
const ReactDOM = require('react-dom');
......@@ -8,7 +6,7 @@ const StoreProvider = require('react-redux').Provider;
const IntlProvider = require('./intl.jsx').IntlProvider;
const permissionsActions = require('../redux/permissions.js');
const sessionActions = require('../redux/session.js');
const reducer = require('../redux/reducer.js');
const configureStore = require('./configure-store.js');
require('../main.scss');
......@@ -36,22 +34,7 @@ const render = (jsx, element, reducers, initialState, enhancer) => {
messages = window._messages[locale];
}
const allReducers = reducer(reducers);
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || redux.compose;
const enhancers = enhancer ?
composeEnhancers(
redux.applyMiddleware(thunk),
enhancer
) :
composeEnhancers(
redux.applyMiddleware(thunk)
);
const store = redux.createStore(
allReducers,
initialState || {},
enhancers
);
const store = configureStore(reducers, initialState, enhancer);
// Render view component
ReactDOM.render(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment