handleAuthStateChange = (dispatch, firebase, authData) => {
  const { config } = firebase._
  if (!authData) {
    // Run onAuthStateChanged if it exists in config and enableEmptyAuthChanges is set to true
    if (typeof config.onAuthStateChanged === 'function') {
      firebase._.config.onAuthStateChanged(authData, firebase, dispatch)
    }
    dispatch({
      type: actionTypes.AUTH_EMPTY_CHANGE,
      preserve: config.preserveOnEmptyAuthChange
    })

    unWatchUserProfile(firebase)
  } else {
    firebase._.authUid = authData.uid // eslint-disable-line no-param-reassign

    // setup presence if settings and database exist
    if (config.presence) {
      setupPresence(dispatch, firebase)
    }

    dispatch({
      type: actionTypes.LOGIN,
      auth: authData,
      preserve: config.preserveOnLogin
    })

    watchUserProfile(dispatch, firebase)

    // Run onAuthStateChanged if it exists in config
    if (typeof config.onAuthStateChanged === 'function') {
      config.onAuthStateChanged(authData, firebase, dispatch)
    }
  }
}
Auth state change handler. Handles response from firebase's onAuthStateChanged
@param {Function} dispatch - Action dispatch function
@param {object} firebase - Internal firebase object
@param  {object} authData - Auth data from firebase's onAuthStateChanged
@private