forked from WorldBrain/Memex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstore.js
33 lines (27 loc) · 966 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
import 'core-js/fn/object/values' // shim Object.values for Chromium<54
import { createStore, applyMiddleware, compose, combineReducers } from 'redux'
import { createEpicMiddleware, combineEpics } from 'redux-observable'
import thunk from 'redux-thunk'
import overview from 'src/overview'
import { reducer as onboarding } from 'src/overview/onboarding'
const rootReducer = combineReducers({
overview: overview.reducer,
onboarding,
})
const rootEpic = combineEpics(...Object.values(overview.epics))
export default function configureStore({ ReduxDevTools = undefined } = {}) {
const enhancers = [
overview.enhancer,
applyMiddleware(createEpicMiddleware(rootEpic), thunk),
]
if (ReduxDevTools) {
enhancers.push(ReduxDevTools.instrument())
}
const enhancer = compose(...enhancers)
const store = createStore(
rootReducer,
undefined, // initial state
enhancer,
)
return store
}