Created
April 10, 2017 05:19
-
-
Save LazyFatArrow/9d49d514b2157411171b2ef4e56edb40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import createSagaMiddleware from 'redux-saga'; | |
import { reactReduxFirebase } from 'react-redux-firebase'; | |
import { | |
createStore, | |
applyMiddleware, | |
compose | |
} from 'redux'; | |
// root reducer | |
import rootReducer from './rootReducer'; | |
// redux devtools | |
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; | |
// root saga | |
import rootSaga from './rootSaga'; | |
// Firebase config | |
var config = { | |
apiKey: <YOUR_API_KEY>, | |
authDomain: <YOUR_AUTH_DOMAIN>, | |
databaseURL: <YOUR_DATABASE_URL>, | |
projectId: <YOUR_PROJECT ID>, | |
storageBucket: <YOUR_STORAGE_BUCKET>, | |
}; | |
// create the store | |
const sagaMiddleware = createSagaMiddleware(); | |
const configureStore = () => { | |
const store = { | |
...createStore(rootReducer, composeEnhancers( | |
applyMiddleware(sagaMiddleware), reactReduxFirebase(config, { | |
userProfile: 'users', // where profiles are stored in database | |
profileFactory: (userData) => { // how profiles are stored in database | |
return { | |
name: userData.displayName, | |
points: 0, | |
} | |
} | |
}))) | |
}; | |
sagaMiddleware.run(rootSaga); | |
return store; | |
}; | |
export default configureStore; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment