import { createStore, applyMiddleware, compose, combineReducers } from 'redux'
import thunk from 'redux-thunk'

export function combine (states) {
  const middleware = applyMiddleware(thunk)
  const enhancers = [middleware]

  if (process.env.NODE_ENV === 'development') {
    const devTools = require('./devtools')
    const devToolsExtension = devTools.default.instrument()
    enhancers.push(devToolsExtension)
  }

  const enhancer = compose(...enhancers)
  const rootReducer = combineReducers(states)
  const store = createStore(rootReducer, enhancer)

  getStore = () => store

  for (const i in states) {
    states[i].dispatch = (type, payload) => store.dispatch({ type, payload })
    states[i].getState = (stateName) => {
      if (stateName === true) return store.getState()
      else if (typeof stateName === 'string') return store.getState()[stateName]

      return store.getState()[states[i]._name]
    }
  }

  // if (module.onReload) {
  //   module.onReload(() => {
  //     // store.replaceReducer(rootReducer)
  //     return true
  //   })
  // }

  return store
}

export function getStore(){}

export function getDevToolsState () {}

export function setDevToolsState () {}

@@ -72,16 +72,116 @@
 'redux'%0A
+import %7B routerMiddleware %7D from 'react-router-redux'%0Aimport %7B browserHistory %7D from 'react-router'%0A
 import t
@@ -282,16 +282,50 @@
 re(thunk
+, routerMiddleware(browserHistory)
 )%0A  cons
@@ -1057,152 +1057,8 @@
  %7D%0A%0A
-  // if (module.onReload) %7B%0A  //   module.onReload(() =%3E %7B%0A  //     // store.replaceReducer(rootReducer)%0A  //     return true%0A  //   %7D)%0A  // %7D%0A%0A
   re

Use react-router-redux middleware required for action-based navigation