2017-02-21 05:13:05 +01:00
|
|
|
import { createStore } from 'refnux'
|
|
|
|
|
|
|
|
const storeInitialState = { counter: 0, key: 'value' }
|
|
|
|
|
|
|
|
const getStore = () => {
|
|
|
|
let store = null
|
2017-02-21 21:52:44 +01:00
|
|
|
if (typeof window === 'undefined') {
|
2017-02-21 05:13:05 +01:00
|
|
|
store = createStore(storeInitialState)
|
|
|
|
} else {
|
|
|
|
store = window.store || createStore(storeInitialState)
|
|
|
|
window.store = store
|
|
|
|
}
|
|
|
|
return store
|
|
|
|
}
|
|
|
|
|
2017-02-21 21:52:44 +01:00
|
|
|
export default getStore
|