Table of Contents

reactReduxFirebase

Middleware that handles configuration (placed in redux's compose call)

Parameters

  • fbConfig
  • otherConfig

Properties

  • fbConfig Object Object containing Firebase config including databaseURL
    • fbConfig.apiKey String Firebase apiKey
    • fbConfig.authDomain String Firebase auth domain
    • fbConfig.databaseURL String Firebase database url
    • fbConfig.storageBucket String Firebase storage bucket
  • config Object Containing react-redux-firebase specific config such as userProfile
    • config.userProfile String Location on firebase to store user profiles
    • config.enableLogging Boolean Whether or not to enable Firebase database logging
    • config.updateProfileOnLogin Boolean Whether or not to update profile when logging in. (default: false)
    • config.resetBeforeLogin Boolean Whether or not to empty profile and auth state on login
    • config.enableRedirectHandling Boolean Whether or not to enable auth redirect handling listener. (default: true)
    • config.onAuthStateChanged Function Function run when auth state changes. Argument Pattern: (authData, firebase, dispatch)
    • config.enableEmptyAuthChanges Boolean Whether or not to enable empty auth changes. When set to true, onAuthStateChanged will be fired with, empty auth changes such as undefined on initialization. See #137 for more details. (default: false)
    • config.onRedirectResult Function Function run when redirect result is returned. Argument Pattern: (authData, firebase, dispatch)
    • config.customAuthParameters Object Object for setting which customAuthParameters are passed to external auth providers.
    • config.profileFactory Function Factory for modifying how user profile is saved.
    • config.fileMetadataFactory Function Factory for modifying how file meta data is written during file uploads
    • config.profileParamsToPopulate (Array | String) Parameters within profile object to populate
    • config.autoPopulateProfile Boolean Whether or not to automatically populate profile with data loaded through profileParamsToPopulate config. (default: true)
    • config.setProfilePopulateResults Boolean Whether or not to call SET actions for data that results from populating profile to redux under the data path. For example role parameter on profile populated from 'roles' root. True will call SET_PROFILE as well as a SET action with the role that is loaded (places it in data/roles). (default: false)

Examples

Setup

import { createStore, compose } from 'redux'
import { reactReduxFirebase } from 'react-redux-firebase'

// React Redux Firebase Config
const config = {
  userProfile: 'users', // saves user profiles to '/users' on Firebase
  // here is where you place other config options
}

// Add react-redux-firebase to compose
// Note: In full projects this will often be within createStore.js or store.js
const createStoreWithFirebase = compose(
 reactReduxFirebase(fbConfig, config),
)(createStore)

// Use Function later to create store
const store = createStoreWithFirebase(rootReducer, initialState)

Custom Auth Parameters

// Follow Setup example with the following config:
const config = {
  customAuthParameters: {
     google: {
       // prompts user to select account on every google login
       prompt: 'select_account'
     }
  }
}

Returns Function That accepts a component and returns a Component which wraps the provided component (higher order component).

results matching ""

    No results matching ""