-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstore.js
More file actions
46 lines (34 loc) · 1.38 KB
/
Copy pathstore.js
File metadata and controls
46 lines (34 loc) · 1.38 KB
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
import { createStore, compose } from 'redux';
import { reactReduxFirebase } from 'react-redux-firebase';
import { AsyncStorage } from 'react-native';
import AppReducer from './app-reducer';
import firebase from 'firebase';
import ApiKeys from './constants/ApiKeys';
// Initialize firebase...
if (!firebase.apps.length) { firebase.initializeApp(ApiKeys.FirebaseConfig); }
export const profilePopulates = [{ child: 'role', root: 'roles' }]
const rrConfig = {
userProfile: 'profiles',
profileParamsToPopulate: profilePopulates, // populate list of todos from todos ref
enableLogging: true,
ReactNative: { AsyncStorage },
attachAuthIsReady: true, // attaches auth is ready promise to store
firebaseStateName: 'firebase', // should match the reducer name ('firebase' is default)
enableRedirectHandling: false // since react-native does not support http or https and isn't a browser
}
export default function configureStore(initialState, history) {
const store = createStore(
AppReducer,
initialState,
compose(
reactReduxFirebase(firebase, rrConfig),
)
);
if(module.hot) {
module.hot.accept('./app-reducer', () => {
const nextAppReducer = require('./app-reducer');
store.replaceReducer(nextAppReducer);
});
}
return store;
}