You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
46 lines
1.4 KiB
2 years ago
|
// import { parse, stringify } from 'flatted';
|
||
|
import { combineReducers } from 'redux';
|
||
|
import { persistReducer, createTransform } from 'redux-persist';
|
||
|
import storage from 'redux-persist/lib/storage';
|
||
|
|
||
|
// modules
|
||
|
import mapReducer from './modules/map/reducers';
|
||
|
|
||
|
const rootReducer = combineReducers({
|
||
|
mapReducer
|
||
|
});
|
||
|
|
||
|
// export const transformCircular = createTransform(
|
||
|
// // (inboundState, key) => JSON.stringify(inboundState),
|
||
|
// // (outboundState, key) => JSON.parse(outboundState),
|
||
|
// (inboundState, key) => stringify(inboundState),
|
||
|
// (outboundState, key) => parse(outboundState),
|
||
|
// )
|
||
|
|
||
|
|
||
|
// const SetTransform = createTransform(
|
||
|
// // transform state on its way to being serialized and persisted.
|
||
|
// (inboundState, key) => {
|
||
|
// // convert mySet to an Array.
|
||
|
// return { ...inboundState, mySet: [...inboundState.mySet] };
|
||
|
// },
|
||
|
// // transform state being rehydrated
|
||
|
// (outboundState, key) => {
|
||
|
// // convert mySet back to a Set.
|
||
|
// return { ...outboundState, mySet: new Set(outboundState.mySet) };
|
||
|
// },
|
||
|
// // define which reducers this transform gets called for.
|
||
|
// { whitelist: ['mapReducer'] }
|
||
|
// );
|
||
|
|
||
|
const persistConfig = {
|
||
|
key: 'root',
|
||
|
storage,
|
||
|
// blacklist: [], // to be not persisted
|
||
|
// transforms: [SetTransform]
|
||
|
// transforms: [transformCircular]
|
||
|
};
|
||
|
|
||
|
// export default persistReducer(persistConfig, rootReducer);
|
||
|
|
||
|
export default rootReducer;
|