-
Notifications
You must be signed in to change notification settings - Fork 0
/
store.js
46 lines (39 loc) · 1.21 KB
/
store.js
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
43
44
45
46
'use strict';
import {
createStore,
applyMiddleware,
} from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension'
import { persistStore, persistReducer } from 'redux-persist'
// import storage from 'redux-persist/lib/storage'
import AsyncStorage from '@react-native-community/async-storage';
// import { createLogger, logger } from "redux-logger";
import reducers from './reducers/index';
// redux saga
import createSagaMiddleware from 'redux-saga';
// middleware
const sagaMiddleware = createSagaMiddleware();
import rootSaga from './sagas/index';
const persistConfig = {
key: 'root',
// storage,
storage: AsyncStorage,
timeout: null,
blacklist: [],
}
// const persistedReducer = persistReducer(persistConfig, reducers);
const store = createStore(
// reducers,
persistReducer(persistConfig, reducers),
composeWithDevTools(
applyMiddleware(sagaMiddleware),
// applyMiddleware(sagaMiddleware,createLogger({collapsed:true})),
// other store enhancers if any
)
// applyMiddleware(sagaMiddleware,createLogger({collapsed:true})),
// applyMiddleware(sagaMiddleware,),
);
sagaMiddleware.run(rootSaga);
const persistor = persistStore(store);
export default store;
export { persistor };