Skip to content

Commit

Permalink
update redux store
Browse files Browse the repository at this point in the history
  • Loading branch information
Inna-Mykytiuk committed Sep 4, 2023
1 parent 47690d8 commit cfcafb7
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions src/redux/store.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
import { configureStore } from '@reduxjs/toolkit';
import { configureStore, combineReducers } from '@reduxjs/toolkit';
import {
persistStore,
persistReducer,
FLUSH,
REHYDRATE,
PAUSE,
PERSIST,
PURGE,
REGISTER,
} from 'redux-persist';
import storage from 'redux-persist/lib/storage';


import { usersReducer } from './usersSlice';
import { filtersReducer } from './filtersSlice';

const rootReducer = combineReducers({
users: usersReducer,
filters: filtersReducer,
})

const persistConfig = {
key: 'root',
storage,
};

const persistTasksReducer = persistReducer(persistConfig, rootReducer);

export const store = configureStore({
reducer: {
users: usersReducer,
filters: filtersReducer,
},
reducer: persistTasksReducer,
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
serializableCheck: {
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
},
}),
});

export const persistor = persistStore(store);

0 comments on commit cfcafb7

Please sign in to comment.