Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 | 7x 7x 7x 21x 7x 7x 1x 6x 5x 1x 21x 21x 21x 21x 42x 42x 7x | // @flow
import merge from 'lodash/merge'
import {combineReducers} from 'redux'
import {routerReducer as routing} from 'react-router-redux'EEE
let configureStore = null
if (process.env.NODE_ENV === 'production') {
configureStore = require('./store.production')
} else if (process.env.NODE_ENV === 'test') {
configureStore = require('./store.mock')
} else {
configureStore = require('./store.development')
}
export default function createStore (reducers) {
const configuredState = safeParse(process.env.STORE)
const locallyStoredState = safeParse(window.localStorage ? window.localStorage.getItem('state') : {})
const store = configureStore(
combineReducers({routing, ...reducers}),
merge(configuredState, locallyStoredState)
)
return store
}
function safeParse (str) {
try {
return JSON.parse(str) || {}
} catch (e) {
return {}
}
}
|