【问题标题】:React redux firebase `profile` is not loaded未加载 React redux firebase `profile`
【发布时间】:2018-08-06 02:18:14
【问题描述】:

配置文件未加载。

更新配置文件执行如下:

firebase.updateProfile(cred)

Firebase 数据条目出现:

root
  \ null
      \ UnIqUeStRiNgIdEnTiFiEr
         | displayName: "Name"
         | email: "test@example.com"
         \ password: "pass"

加载该配置文件后,displayName 可见。

现在退出并重新登录:

登录方式为:

firebase.login(creds).catch(err => showError(err.message))

redux 状态:

root
  \ firbase
      | profile
      |  | isLoaded: false
      |  \ isEmpty: true
      |
      \ auth
         | uid: "UnIqUeStRiNgIdEnTiFiEr"
         | displayName: null
         \ email: "test@example.com"

配置文件未加载,displayName 不可见。

怎么了?需要检查什么?加载配置文件需要踢什么?

【问题讨论】:

  • 就我而言,如果您尝试使用无密码登录,则没有记录 react-redux-firebase。我必须使用电子邮件和密码才能使用它。

标签: node.js reactjs firebase redux react-redux-firebase


【解决方案1】:

Redux 存储需要一个 firebase 中间件。

Firebase 中间件创建者reactReduxFirebase(firebase, firebaseReduxConfig) 需要配置用于存储 Firebase 配置文件。应该是这样的:

const firebaseReduxConfig = {
  userProfile: 'users', // root for user profiles
  // ...
}

在我的情况下,配置被错误地导入为default 而不是named。因此配置文件被保存到有问题的null 根条目。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-25
    • 2017-11-21
    • 2018-06-06
    • 1970-01-01
    • 1970-01-01
    • 2018-05-30
    • 2018-05-16
    • 2019-06-23
    相关资源
    最近更新 更多