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.
65 lines
1.7 KiB
65 lines
1.7 KiB
import AsyncStorage from "@react-native-async-storage/async-storage"; |
|
import { applyMiddleware, createStore, compose, combineReducers } from "redux"; |
|
import thunk from "redux-thunk"; |
|
import { persistStore, persistReducer } from "redux-persist"; |
|
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2"; |
|
import publicApi from "./reducers/public"; |
|
import user from "./reducers/user"; |
|
import book from "./reducers/book"; |
|
import blog from "./reducers/blog"; |
|
import product from "./reducers/product"; |
|
import faq from "./reducers/faq"; |
|
import file from "./reducers/file"; |
|
import userFactor from "./reducers/userFactor"; |
|
import userProduct from "./reducers/userProduct"; |
|
import qr from "./reducers/qr"; |
|
import userAddress from "./reducers/userAddress"; |
|
import transport from "./reducers/transport"; |
|
import comment from "./reducers/comment"; |
|
import form from "./reducers/form"; |
|
import userFavorite from "./reducers/userFavorite"; |
|
import vote from "./reducers/vote"; |
|
|
|
const persistConfig = { |
|
key: "root", |
|
storage: AsyncStorage, |
|
stateReconciler: autoMergeLevel2, // see "Merge Process" section for details. |
|
whitelist: ["profile"], |
|
}; |
|
|
|
const initialState = {}; |
|
|
|
const middleWare = [thunk]; |
|
|
|
const persistedReducer = persistReducer( |
|
persistConfig, |
|
combineReducers({ |
|
publicApi, |
|
user, |
|
book, |
|
blog, |
|
product, |
|
faq, |
|
file, |
|
userFactor, |
|
userProduct, |
|
qr, |
|
userAddress, |
|
transport, |
|
comment, |
|
form, |
|
userFavorite, |
|
vote, |
|
}) |
|
); |
|
|
|
console.disableYellowBox = true; |
|
|
|
export const store = createStore( |
|
persistedReducer, |
|
initialState, |
|
compose(applyMiddleware(...middleWare)) |
|
); |
|
|
|
export const persistor = persistStore(store); |
|
|
|
|