Skip to content

Latest commit

 

History

History
181 lines (161 loc) · 9.25 KB

constants.md

File metadata and controls

181 lines (161 loc) · 9.25 KB

Table of Contents

actionsPrefix

Prefix for all actions within library

Type: string

Examples

import { constants } from 'react-redux-firebase'
constants.actionsPrefix === '@@reactReduxFirebase' // true

actionTypes

Object containing all action types

Type: object

Properties

  • START string @@reactReduxFirebase/START
  • SET string @@reactReduxFirebase/SET
  • REMOVE string @@reactReduxFirebase/REMOVE
  • MERGE string @@reactReduxFirebase/MERGE
  • SET_PROFILE string @@reactReduxFirebase/SET_PROFILE
  • LOGIN string @@reactReduxFirebase/LOGIN
  • LOGOUT string @@reactReduxFirebase/LOGOUT
  • LOGIN_ERROR string @@reactReduxFirebase/LOGIN_ERROR
  • NO_VALUE string @@reactReduxFirebase/NO_VALUE
  • UNAUTHORIZED_ERROR string @@reactReduxFirebase/UNAUTHORIZED_ERROR
  • ERROR string @@reactReduxFirebase/ERROR
  • SET_LISTENER string @@reactReduxFirebase/SET_LISTENER
  • UNSET_LISTENER string @@reactReduxFirebase/UNSET_LISTENER
  • AUTHENTICATION_INIT_STARTED string @@reactReduxFirebase/AUTHENTICATION_INIT_STARTED
  • AUTHENTICATION_INIT_FINISHED string @@reactReduxFirebase/AUTHENTICATION_INIT_FINISHED
  • SESSION_START string @@reactReduxFirebase/SESSION_START
  • SESSION_END string @@reactReduxFirebase/SESSION_END
  • FILE_UPLOAD_START string @@reactReduxFirebase/FILE_UPLOAD_START
  • FILE_UPLOAD_ERROR string @@reactReduxFirebase/FILE_UPLOAD_ERROR
  • FILE_UPLOAD_PROGRESS string @@reactReduxFirebase/FILE_UPLOAD_PROGRESS
  • FILE_UPLOAD_COMPLETE string @@reactReduxFirebase/FILE_UPLOAD_COMPLETE
  • FILE_DELETE_START string @@reactReduxFirebase/FILE_DELETE_START
  • FILE_DELETE_ERROR string @@reactReduxFirebase/FILE_DELETE_ERROR
  • FILE_DELETE_COMPLETE string @@reactReduxFirebase/FILE_DELETE_COMPLETE
  • AUTH_UPDATE_START string @@reactReduxFirebase/AUTH_UPDATE_START
  • AUTH_UPDATE_ERROR string @@reactReduxFirebase/AUTH_UPDATE_ERROR
  • AUTH_UPDATE_SUCCESS string @@reactReduxFirebase/AUTH_UPDATE_SUCCESS
  • PROFILE_UPDATE_START string @@reactReduxFirebase/PROFILE_UPDATE_START
  • PROFILE_UPDATE_ERROR string @@reactReduxFirebase/PROFILE_UPDATE_ERROR
  • PROFILE_UPDATE_SUCCESS string @@reactReduxFirebase/PROFILE_UPDATE_SUCCESS
  • EMAIL_UPDATE_START string @@reactReduxFirebase/EMAIL_UPDATE_START
  • EMAIL_UPDATE_ERROR string @@reactReduxFirebase/EMAIL_UPDATE_ERROR
  • EMAIL_UPDATE_SUCCESS string @@reactReduxFirebase/EMAIL_UPDATE_SUCCESS
  • AUTH_RELOAD_START string @@reactReduxFirebase/AUTH_RELOAD_START
  • AUTH_RELOAD_ERROR string @@reactReduxFirebase/AUTH_RELOAD_ERROR
  • AUTH_RELOAD_SUCCESS string @@reactReduxFirebase/AUTH_RELOAD_SUCCESS
  • AUTH_LINK_START string @@reactReduxFirebase/AUTH_LINK_START
  • AUTH_LINK_ERROR string @@reactReduxFirebase/AUTH_LINK_ERROR
  • AUTH_LINK_SUCCESS string @@reactReduxFirebase/AUTH_LINK_SUCCESS
  • AUTH_EMPTY_CHANGE string @@reactReduxFirebase/AUTH_LINK_SUCCESS

Examples

import { actionTypes } from 'react-redux-firebase'
actionTypes.SET === '@@reactReduxFirebase/SET' // true

defaultConfig

Default configuration options

Type: object

Properties

  • userProfile string null Location on Firebase where user profiles are stored. Often set to 'users'.
  • profileFactory Function null Function for changing how profile is written to database (both RTDB and Firestore).
  • presence (string | Function) null Location on Firebase where of currently online users is stored. Often set to 'presence' or 'onlineUsers'. If a function is passed, the arguments are: (currentUser, firebase).
  • sessions (string | Function) sessions Location on Firebase where user sessions are stored (only if presense is set). Often set to 'sessions' or 'userSessions'. If a function is passed, the arguments are: (currentUser, firebase).
  • enableLogging boolean false (deprecated) Whether or not firebase database logging is enabled. Providing true turns on error logging (enabled by itself through logErrors).
  • logErrors boolean true Whether or not to log internal Firebase errors (i.e. error querying or writing data) to the javascript console .
  • preserveOnLogout (Array | object) null Data parameters to preserve when logging out. If Array is passed, each item represents keys within state.firebase.data preserve. If an object is passed, Keys associate with parts of state to preserve, and the values are Arrays contain keys for keys within that slice of state to preserve.
  • preserveOnEmptyAuthChange object null Data parameters to preserve when empty auth changes occur. Keys associate with parts of state to preserve, and the values are either Arrays or Functions. If passing an array of keys (i.e. { auth: ['key1', 'key2'] }) - those keys ('key1' and 'key2') are preserved from that slice of state (auth). If passing a function (i.e. { auth: (currentAuthState, nextAuthState) => ({}) }), whatever is returned from the function is set to that slice of state (auth).
  • updateProfileOnLogin boolean true Whether or not to update user profile when logging in.
  • useFirestoreForProfile boolean false Write profile data to Firestore instead of Real Time Database.
  • useFirestoreForStorageMeta boolean false Write storage file metadata to Firestore instead of Real Time Database.
  • resetBeforeLogin boolean true Whether or not to reset auth and profile when logging in (see issue #254 for more details).
  • enableRedirectHandling boolean true Whether or not to enable redirect handling. This must be disabled if environment is not http/https such as with react-native.
  • onAuthStateChanged Function null Function that runs when auth state changes.
  • enableEmptyAuthChanges boolean false 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). Requires v1.5.0-alpha or higher.
  • autoPopulateProfile boolean false REMOVED FROM v2.0.0. Whether or not to automatically populate profile with data loaded through profileParamsToPopulate config.
  • setProfilePopulateResults boolean true 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).
  • dispatchOnUnsetListener boolean true Whether or not to dispatch UNSET_LISTENER when disabling listeners for a specific path. USE WITH CAUTION Setting this to true allows an action to be called that removes data from redux (which might not always be expected).
  • dispatchRemoveAction boolean false Whether or not to dispatch REMOVE action when calling remove. NOTE Causes two state updates if a listener is affected by your remove call.
  • firebaseStateName string 'firebase' Assumed name of Firebase state (name given when passing reducer to combineReducers). Used in firebaseAuthIsReady promise (see #264).
  • attachAuthIsReady boolean true Whether or not to attach firebaseAuthIsReady to store. authIsLoaded can be imported and used directly instead based on preference.
  • firestoreNamespace boolean firestoreHelpers Namespace for firestore helpers (WARNING Changing this will break firestoreConnect HOC. Do NOT change to 'firestore')
  • keysToRemoveFromAuth Array (default at end) list of keys to remove from authentication reponse before writing to profile (currenlty only used for profiles stored on Firestore). ['appName', 'apiKey' , 'authDomain', 'redirectEventId', 'stsTokenManager', 'uid']