2017-11-13 19:37:43 +00:00
|
|
|
import { createStore, applyMiddleware } from 'redux'
|
|
|
|
import thunkMiddleware from 'redux-thunk'
|
|
|
|
import { createLogger } from 'redux-logger'
|
2018-02-04 11:56:32 +00:00
|
|
|
import { createEpicMiddleware } from 'redux-observable'
|
|
|
|
import reducer from './reducer'
|
|
|
|
import { rootEpic } from './epics'
|
2017-11-13 19:37:43 +00:00
|
|
|
|
|
|
|
export default function initStore (initialState) {
|
|
|
|
const epicMiddleware = createEpicMiddleware(rootEpic)
|
|
|
|
const logger = createLogger({ collapsed: true }) // log every action to see what's happening behind the scenes.
|
|
|
|
const reduxMiddleware = applyMiddleware(thunkMiddleware, epicMiddleware, logger)
|
|
|
|
|
2018-02-04 11:56:32 +00:00
|
|
|
return createStore(reducer, initialState, reduxMiddleware)
|
2017-11-13 19:37:43 +00:00
|
|
|
};
|