28 lines
704 B
TypeScript
28 lines
704 B
TypeScript
import { applyMiddleware, compose, createStore } from "redux";
|
|
import rootReducer from "@/state/reducer";
|
|
import { devToolsEnhancer } from "redux-devtools-extension";
|
|
import { persistReducer, persistStore } from "redux-persist"
|
|
import sessionStorage from "redux-persist/lib/storage/session"
|
|
import thunk from "redux-thunk";
|
|
|
|
const store = createStore(
|
|
persistReducer(
|
|
{
|
|
key: 'state',
|
|
storage: sessionStorage,
|
|
blacklist: ['edition']
|
|
},
|
|
rootReducer
|
|
),
|
|
compose(
|
|
applyMiddleware(thunk),
|
|
devToolsEnhancer({})
|
|
)
|
|
);
|
|
|
|
export const persistor = persistStore(store);
|
|
|
|
(window as any)._store = store;
|
|
|
|
export default store;
|