import {createStore, combineReducers, compose, applyMiddleware} from 'redux';
import {routerReducer, routerMiddleware} from 'react-router-redux';
import {reducer as reduxAsyncConnect} from 'redux-connect';
import thunkMiddleware from 'redux-thunk';

function configureStoreCreator(reducers, middleware = [thunkMiddleware]) {
  const reducer = combineReducers({
    routing: routerReducer,
    reduxAsyncConnect,
    ...reducers
  });

  return (forClient, history, initialState = {}) => {
    const devToolsEnhancer = forClient && window.devToolsExtension ? window.devToolsExtension() : f => f;
    return createStore(
      reducer,
      initialState,
      compose(
        applyMiddleware(
          ...middleware,
          routerMiddleware(history)
        ),
        devToolsEnhancer
      )
    );
  };
}

export default configureStoreCreator;

@@ -296,16 +296,22 @@
 leware =
+ () =%3E
  %5BthunkM
@@ -481,16 +481,21 @@
 ate = %7B%7D
+, req
 ) =%3E %7B%0A 
@@ -721,16 +721,21 @@
 ddleware
+(req)
 ,%0A      

Provision of middleware now requires function to allow request to be passed in on server-side