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.

store.js 838B

12345678910111213141516171819202122232425262728293031323334
  1. import { configureStore } from "@reduxjs/toolkit";
  2. import { apiSlice } from "./api/apiSlice";
  3. import authReducer from "./auth/authSlice";
  4. import {
  5. persistReducer,
  6. persistStore,
  7. FLUSH,
  8. REHYDRATE,
  9. PAUSE,
  10. PERSIST,
  11. PURGE,
  12. REGISTER,
  13. } from "redux-persist";
  14. import AsyncStorage from "@react-native-async-storage/async-storage";
  15. const authPersistConfig = {
  16. key: "auth",
  17. storage: AsyncStorage,
  18. };
  19. export const store = configureStore({
  20. reducer: {
  21. [apiSlice.reducerPath]: apiSlice.reducer,
  22. auth: persistReducer(authPersistConfig, authReducer),
  23. },
  24. middleware: (getDefaultMiddleware) =>
  25. getDefaultMiddleware({
  26. serializableCheck: {
  27. ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
  28. },
  29. }).concat(apiSlice.middleware),
  30. });
  31. export const persistor = persistStore(store);