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)
|
2018-03-27 18:11:03 +00:00
|
|
|
const logger = createLogger({ collapsed: true }) // log every action to see what's happening behind the scenes.
|
2017-11-13 19:37:43 +00:00
|
|
|
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
|
|
|
};
|