-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add store.js file to handle store configuration (#1666)
- Loading branch information
1 parent
cc56f8c
commit c394cba
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { createStore } from 'redux' | ||
import { persistStore, persistReducer } from 'redux-persist' | ||
import storage from 'redux-persist/lib/storage' | ||
import { createBrowserHistory } from 'history' | ||
|
||
import createRootReducer from '../reducers' | ||
import createMiddleware from '../middleware' | ||
|
||
const persistConfig = { | ||
key: 'root', | ||
storage, | ||
} | ||
|
||
export const history = createBrowserHistory() | ||
|
||
const persistedReducer = persistReducer(persistConfig, createRootReducer(history)) | ||
|
||
export const store = createStore(persistedReducer, createMiddleware(history)) | ||
|
||
export let persistor = persistStore(store) |