import { combineReducers, configureStore } from "@reduxjs/toolkit"; import { persistReducer, persistStore } from "redux-persist"; import storage from "redux-persist/es/storage"; import phaseReducer from "./slices/phaseSlice"; import timeReducer from "./slices/timeSlice"; const persistConfig = { key: "root", storage: storage, whitelist: ["time", "phase"], }; const rootReducer = combineReducers({ time: timeReducer, phase: phaseReducer, }); const persistedReducer = persistReducer(persistConfig, rootReducer); export const store = configureStore({ reducer: persistedReducer, middleware: (getDefaultMiddleware) => getDefaultMiddleware({ serializableCheck: { ignoredActions: ["persist/PERSIST", "persist/REHYDRATE"], }, }), }); export const persistor = persistStore(store); export type RootState = ReturnType; export type AppDispatch = typeof store.dispatch; export type AppStore = typeof store;