Skip to content

Instantly share code, notes, and snippets.

@pfulop
Created August 24, 2016 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfulop/58cc108f58878af867f1f3330d7319c3 to your computer and use it in GitHub Desktop.
Save pfulop/58cc108f58878af867f1f3330d7319c3 to your computer and use it in GitHub Desktop.
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