diff --git a/src/index.js b/src/index.js index e54f62847f..39af8dc88f 100644 --- a/src/index.js +++ b/src/index.js @@ -6,6 +6,11 @@ import ReactDOM from 'react-dom' import { initSentry } from './utils/sentry' import { createStore } from 'redux' + +import { persistStore, persistReducer } from 'redux-persist' +import storage from 'redux-persist/lib/storage' +import { PersistGate } from 'redux-persist/integration/react' + import { Provider } from 'react-redux' import { LocalizeProvider } from 'react-localize-redux'; import { createBrowserHistory } from 'history' @@ -17,9 +22,17 @@ import Routing from './components/Routing' initSentry(); +const persistConfig = { + key: 'root', + storage, +} + const history = createBrowserHistory() -export const store = createStore(createRootReducer(history), createMiddleware(history)) +const persistedReducer = persistReducer(persistConfig, createRootReducer(history)) + +export const store = createStore(persistedReducer, createMiddleware(history)) +let persistor = persistStore(store) ReactDOM.render(