-
Notifications
You must be signed in to change notification settings - Fork 789
/
root.reducer.js
36 lines (33 loc) · 1.1 KB
/
root.reducer.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
import { combineReducers } from 'redux';
import { persistReducer } from 'redux-persist';
import createEncryptor from 'redux-persist-transform-encrypt';
import md5 from 'md5';
import DeviceInfo from 'react-native-device-info';
import AsyncStorage from '@react-native-community/async-storage';
import { authReducer } from 'auth';
import { userReducer } from 'user';
import { repositoryReducer } from 'repository';
import { organizationReducer } from 'organization';
import { issueReducer } from 'issue';
import { notificationsReducer } from 'notifications';
import { entities, pagination } from 'api/reducers';
const encryptor = createEncryptor({
secretKey: md5(DeviceInfo.getUniqueID()),
});
const rootPersistConfig = {
key: 'root',
storage: AsyncStorage,
transforms: [encryptor],
whitelist: ['auth'],
};
const rootReducer = combineReducers({
auth: authReducer,
user: userReducer,
repository: repositoryReducer,
organization: organizationReducer,
issue: issueReducer,
notifications: notificationsReducer,
entities,
pagination,
});
export default persistReducer(rootPersistConfig, rootReducer);