git ssb

1+

dinoworm ๐Ÿ› / catstack



Tree: d257f1cb78aa333ab6399429df9d754ce4f561f5

Files: d257f1cb78aa333ab6399429df9d754ce4f561f5 / app / store.js

1022 bytesRaw
1const { createStore, compose, applyMiddleware } = require('redux')
2const thunk = require('redux-thunk')
3const { createHistory } = require('history')
4
5const reducer = require('app/reducers')
6
7let storeEnhancers = []
8let middleware = []
9
10middleware.push(thunk)
11
12if (process.env.NODE_ENV === 'development') {
13 var logger = require('redux-logger')
14 var { persistState } = require('redux-devtools')
15
16 var DevTools = require('app/components/dev-tools')
17}
18
19storeEnhancers.push(
20 applyMiddleware(...middleware)
21)
22
23if (process.env.NODE_ENV === 'development') {
24 storeEnhancers.push(
25 applyMiddleware(logger())
26 )
27 storeEnhancers.push(DevTools.instrument())
28
29 if (module.browser) {
30 storeEnhancers.push(persistState(
31 window.location.href.match(
32 /[?&]debug_session=([^&]+)\b/
33 )
34 ))
35 }
36}
37
38const createEnhancedStore = compose(
39 ...storeEnhancers
40)(createStore)
41
42function finalCreateStore(initialState) {
43 return createEnhancedStore(reducer, initialState)
44}
45
46module.exports = finalCreateStore
47

Built with git-ssb-web