import { applyMiddleware, compose, createStore } from 'redux'
import thunk from 'redux-thunk'
import createLogger from 'redux-logger'
import { rootReducer } from './root'


export default (initialState = {}) => {
  const logger = createLogger({
    collapsed: true,
  })
  let middleware = applyMiddleware(thunk)

  if (process.env.NODE_ENV !== 'production') {
    middleware = compose(middleware, logger)
    // configure redux-devtools-extension
    // @see https://github.com/zalmoxisus/redux-devtools-extension
    const devToolsExtension = window.devToolsExtension
    if (typeof devToolsExtension === 'function') {
      middleware = compose(middleware, devToolsExtension())
    }
  }

  const store = createStore(rootReducer, initialState, middleware)

  if (module.hot) {
    module.hot.accept('./root', () => {
      store.replaceReducer(rootReducer.default)
    })
  }

  return store
}

@@ -264,16 +264,17 @@
 e,%0A  %7D)%0A
+%0A
   let mi
@@ -285,34 +285,8 @@
 ware
- = applyMiddleware(thunk)%0A
 %0A  i
@@ -313,11 +313,11 @@
 ENV 
-!
 ==
+=
  'pr
@@ -350,35 +350,141 @@
 e = 
-compose(middleware, logger)
+applyMiddleware(thunk)%0A  %7D else %7B%0A    middleware = applyMiddleware(thunk, logger)%0A  %7D%0A%0A  if (process.env.NODE_ENV !== 'production') %7B
 %0A   

Update store