-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStore.js
More file actions
42 lines (37 loc) · 1022 Bytes
/
Store.js
File metadata and controls
42 lines (37 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { combineReducers, configureStore } from "@reduxjs/toolkit";
import AsyncStorage from "@react-native-async-storage/async-storage";
import {
persistReducer,
persistStore,
FLUSH,
REHYDRATE,
PAUSE,
PERSIST,
PURGE,
REGISTER,
} from "redux-persist";
import cartReducer from "./src/Features/Cart/CartSlice";
import orderReducer from "./src/Features/Order/OrderSlice";
const persistConfig = {
key: "root",
version: 1,
storage: AsyncStorage,
whitelist: ["cart", "order"],
};
const rootReducer = combineReducers({
cart: cartReducer,
order: orderReducer,
});
const persistedReducer = persistReducer(persistConfig, rootReducer);
export const store = configureStore({
reducer: persistedReducer,
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
serializableCheck: {
ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER],
},
serializableCheck: false,
immutableCheck: false,
}),
});
export let persistor = persistStore(store);