@@ -60,29 +60,29 @@ import { compose, createStore, applyMiddleware } from 'redux'
60
60
import { getFirebase , reactReduxFirebase } from ' react-redux-firebase'
61
61
62
62
// Firebase config
63
- const firebaseConfig = {
63
+ const fbConfig = {
64
64
apiKey: ' <your-api-key>' ,
65
65
authDomain: ' <your-auth-domain>' ,
66
66
databaseURL: ' <your-database-url>' ,
67
67
storageBucket: ' <your-storage-bucket>'
68
68
}
69
69
// react-redux-firebase options
70
- const config = {
70
+ const rrfConfig = {
71
71
userProfile: ' users' , // firebase root where user profiles are stored
72
72
attachAuthIsReady: true , // attaches auth is ready promise to store
73
73
firebaseStateName: ' firebase' // should match the reducer name ('firebase' is default)
74
74
}
75
75
76
76
const createStore = (initialState = {}) => {
77
77
// Initialize Firebase instance
78
- firebase .initializeApp (firebaseConfig )
78
+ firebase .initializeApp (fbConfig )
79
79
80
80
// Add redux Firebase to compose
81
81
const createStoreWithFirebase = createStore (
82
82
rootReducer,
83
83
initialState,
84
84
compose (
85
- reactReduxFirebase (firebase, config ),
85
+ reactReduxFirebase (firebase, rrfConfig ),
86
86
applyMiddleware (thunk .withExtraArgument (getFirebase))
87
87
)
88
88
)
@@ -138,12 +138,12 @@ The logic that runs this is partially based on:
138
138
Include the ` userProfile ` parameter in config when setting up store middleware:
139
139
140
140
``` js
141
- const config = {
141
+ const rrfConfig = {
142
142
userProfile: ' users' , // where profiles are stored in database
143
143
presence: ' presence' , // where list of online users is stored in database
144
144
sessions: ' sessions' // where list of user sessions is stored in database (presence must be enabled)
145
145
}
146
- reactReduxFirebase (firebaseConfig, config )
146
+ reactReduxFirebase (fbConfig, rrfConfig )
147
147
```
148
148
149
149
Now when logging in through ` login ` method, user will be listed as online until they logout or end the session (close the tab or window).
0 commit comments