Created
August 24, 2016 07:58
-
-
Save pfulop/58cc108f58878af867f1f3330d7319c3 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 { createStore,applyMiddleware } from 'redux'; | |
import rootReducer from '../reducers'; | |
import {APIKEY,AUTHDOMAIN,DATABASEURL,STORAGEBUCKET} from '../../config.js'; | |
import firebase from 'firebase'; | |
import thunk from 'redux-thunk'; | |
export default function configureStore () { | |
const firebaseConfig = { | |
apiKey: APIKEY, | |
authDomain: AUTHDOMAIN, | |
databaseURL: DATABASEURL, | |
storageBucket: STORAGEBUCKET, | |
}; | |
const firebaseApp = firebase.initializeApp(firebaseConfig); | |
const middleware = applyMiddleware(thunk.withExtraArgument(firebaseApp)); | |
const store =createStore(rootReducer,middleware); | |
if (module.hot) { | |
module.hot.accept(() => { | |
const nextRootReducer = require('../reducers/index').default; | |
store.replaceReducer(nextRootReducer); | |
}); | |
} | |
return store; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment