12345678910111213141516171819202122232425262728293031323334 |
- import { configureStore } from "@reduxjs/toolkit";
- import { apiSlice } from "./api/apiSlice";
- import authReducer from "./auth/authSlice";
- import {
- persistReducer,
- persistStore,
- FLUSH,
- REHYDRATE,
- PAUSE,
- PERSIST,
- PURGE,
- REGISTER,
- } from "redux-persist";
- import AsyncStorage from "@react-native-async-storage/async-storage";
-
- const authPersistConfig = {
- key: "auth",
- storage: AsyncStorage,
- };
-
- export const store = configureStore({
- reducer: {
- [apiSlice.reducerPath]: apiSlice.reducer,
- auth: persistReducer(authPersistConfig, authReducer),
- },
- middleware: (getDefaultMiddleware) =>
- getDefaultMiddleware({
- serializableCheck: {
- ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
- },
- }).concat(apiSlice.middleware),
- });
-
- export const persistor = persistStore(store);
|