import { createStore, applyMiddleware, combineReducers } from 'redux'
import { apiMiddleware } from 'redux-api-middleware'
import { routerReducer } from 'react-router-redux'

import * as reducers from '../reducers/reducers'
import initialState from './initialState'

const reducer = combineReducers({
  ...reducers,
  routing: routerReducer
})

const createStoreWithMiddleware = applyMiddleware(apiMiddleware)(createStore);

function configureStore (initialState) {
  return createStoreWithMiddleware(reducer, initialState);
}

const store = configureStore(initialState)

export default store


import { createStore, applyMiddleware, combineReducers } from 'redux'
import thunk from 'redux-thunk'
import { routerReducer } from 'react-router-redux'

import * as reducers from '../reducers/reducers'

const reducer = combineReducers({
  ...reducers,
  routing: routerReducer
})

const store = createStore(
  reducer,
  applyMiddleware(thunk)
);

export default store

change way to create store with redux and redux-thunk