forked from WebMemex/webmemex-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
store.js
34 lines (28 loc) · 818 Bytes
/
store.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { createStore, applyMiddleware, compose, combineReducers } from 'redux'
import { createEpicMiddleware, combineEpics } from 'redux-observable'
import thunk from 'redux-thunk'
import overview from 'src/overview'
const rootReducer = combineReducers({
overview: overview.reducer,
})
const rootEpic = combineEpics(
...Object.values(overview.epics)
)
export default function configureStore({ReduxDevTools = undefined} = {}) {
const enhancers = [
applyMiddleware(
createEpicMiddleware(rootEpic),
thunk
),
]
if (ReduxDevTools) {
enhancers.push(ReduxDevTools.instrument())
}
const enhancer = compose(...enhancers)
const store = createStore(
rootReducer,
undefined, // initial state
enhancer
)
return store
}