text: import {
    persistStore,
    persistReducer,
    FLUSH,
    REHYDRATE,
    PAUSE,
    PERSIST,
    PURGE,
    REGISTER,
  } from 'redux-persist';
  import storage from 'redux-persist/lib/storage';
  import {
    configureStore,
    combineReducers,
    getDefaultMiddleware,
  } from '@reduxjs/toolkit';
  import contactsReducer from '../contacts/contactsReducers';
  import userReduser from '../auth/auth-slice';
  import errorReducer from '../error/error-reducer';
  
  const middleware = [
    ...getDefaultMiddleware({
      serializableCheck: {
        ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
      },
    }),
  ];
  
  const authPersistConfig = {
    key: 'auth',
    storage,
    whitelist: ['token'],
  };
  
  const rootReducer = combineReducers({
    contacts: contactsReducer,
    user: persistReducer(authPersistConfig, userReduser),
    error: errorReducer,
  });
  
  const store = configureStore({
    reducer: rootReducer,
    middleware,
    devTools: process.env.NODE_ENV === 'development',
  });
  export default store;
  
  export const persistor = persistStore(store);
  