Skip to content
Permalink
Browse files

Set up store and react-redux-firebase

  • Loading branch information...
dusty-phillips committed Aug 27, 2018
1 parent 232a3d2 commit c863c09f9b71f9069fceb0bcdbc8522eb28dc9c4
Showing with 52 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +11 −0 src/redux/reducers.js
  3. +39 −0 src/redux/store.js
@@ -19,3 +19,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

firebaseConfig.js
@@ -0,0 +1,11 @@
import { combineReducers } from 'redux'
import { firebaseReducer } from 'react-redux-firebase'
import { firestoreReducer } from 'redux-firestore'

export const initialState = {}


export const rootReducer = combineReducers({
firebase: firebaseReducer,
firestore: firestoreReducer,
})
@@ -0,0 +1,39 @@
import { createStore, compose } from 'redux'
import { reactReduxFirebase } from 'react-redux-firebase'
import { reduxFirestore } from 'redux-firestore'


import firebase from 'firebase/app'
import 'firebase/auth'
import 'firebase/firestore'

import firebaseConfig from '../firebaseConfig.js'
import { initialState, rootReducer } from './reducers'

firebase.initializeApp(firebaseConfig)
firebase.firestore().settings({ timestampsInSnapshots: true })

const enhancers = [
reduxFirestore(firebase),
reactReduxFirebase(firebase, {
userProfile: 'users',
useFirestoreForProfile: true,
}),
]

const reduxDevToolsExtension = window.devToolsExtension
if (
process.env.NODE_ENV === "development" &&
typeof reduxDevToolsExtension === "function"
) {
enhancers.push(reduxDevToolsExtension())
}

const composedEnhancers = compose(
...enhancers
)

const store = createStore(rootReducer, initialState, composedEnhancers)


export default store

0 comments on commit c863c09

Please sign in to comment.
You can’t perform that action at this time.