35 lines
907 B
JavaScript
35 lines
907 B
JavaScript
import { configureStore, combineReducers } from "@reduxjs/toolkit";
|
|
import monitorsReducer from "./Features/Monitors/monitorsSlice";
|
|
import authReducer from "./Features/Auth/authSlice";
|
|
import storage from "redux-persist/lib/storage";
|
|
import { persistReducer, persistStore } from "redux-persist";
|
|
|
|
const persistConfig = {
|
|
key: "root",
|
|
storage,
|
|
whitielist: ["auth", "monitors"],
|
|
};
|
|
|
|
const rootReducer = combineReducers({
|
|
monitors: monitorsReducer,
|
|
auth: authReducer,
|
|
});
|
|
|
|
const persistedReducer = persistReducer(persistConfig, rootReducer);
|
|
|
|
export const store = configureStore({
|
|
reducer: persistedReducer,
|
|
middleware: (getDefaultMiddleware) =>
|
|
getDefaultMiddleware({
|
|
serializableCheck: {
|
|
ignoredActions: [
|
|
"persist/PERSIST",
|
|
"persist/REHYDRATE",
|
|
"persist/REGISTER",
|
|
],
|
|
},
|
|
}),
|
|
});
|
|
|
|
export const persistor = persistStore(store);
|