persist store

This commit is contained in:
2019-07-23 17:26:36 +02:00
parent 570c8482f6
commit 551b6af2d5
3 changed files with 15 additions and 2 deletions
+1
View File
@@ -50,6 +50,7 @@
"recordrtc": "^5.5.4",
"redux": "^4.0.1",
"redux-devtools-extension": "^2.13.8",
"redux-persist": "^5.10.0",
"redux-saga": "^1.0.2",
"reselect": "^4.0.0",
"style-loader": "^0.23.1",
+9 -2
View File
@@ -1,9 +1,16 @@
import { applyMiddleware, createStore } from 'redux'
import createSagaMiddleware from 'redux-saga'
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage' // defaults to localStorage for web
import rootReducer, { exampleInitialState } from './rootReducer'
import rootSaga from './rootSaga'
const persistConfig = {
key: 'app.talentstube.com',
storage,
}
const persistedReducer = persistReducer(persistConfig, rootReducer)
const bindMiddleware = middleware => {
if (process.env.NODE_ENV !== 'production') {
const { composeWithDevTools } = require('redux-devtools-extension')
@@ -15,7 +22,7 @@ const bindMiddleware = middleware => {
function configureStore (initialState = exampleInitialState) {
const sagaMiddleware = createSagaMiddleware()
const store = createStore(
rootReducer,
persistedReducer,
initialState,
bindMiddleware([sagaMiddleware])
)
+5
View File
@@ -8221,6 +8221,11 @@ redux-devtools-extension@^2.13.8:
resolved "https://registry.yarnpkg.com/redux-devtools-extension/-/redux-devtools-extension-2.13.8.tgz#37b982688626e5e4993ff87220c9bbb7cd2d96e1"
integrity sha512-8qlpooP2QqPtZHQZRhx3x3OP5skEV1py/zUdMY28WNAocbafxdG2tRD1MWE7sp8obGMNYuLWanhhQ7EQvT1FBg==
redux-persist@^5.10.0:
version "5.10.0"
resolved "https://registry.yarnpkg.com/redux-persist/-/redux-persist-5.10.0.tgz#5d8d802c5571e55924efc1c3a9b23575283be62b"
integrity sha512-sSJAzNq7zka3qVHKce1hbvqf0Vf5DuTVm7dr4GtsqQVOexnrvbV47RWFiPxQ8fscnyiuWyD2O92DOxPl0tGCRg==
redux-saga@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-1.0.2.tgz#0599703f975438f1b2f9d2b9a965ec58f0fdfcd7"