Dax*_*hen 11 firebase firebase-authentication vuex
我使用的火力权威性和当用户改变他们的个人资料,如他们displayName,photoURL或者email等onAuthStateChanged回调不会被解雇,但底层firebase.auth().currentUser就会自动更新。
我需要在用户更新他们的个人资料后更新 UI,即。我想firebase.auth().currentUser与客户商店(特别是vuex或类似redux商店)保持同步。
有没有办法观察firebase.auth().currentUser更改,或者我可以使用任何其他钩子在firebase.auth().currentUser更改时收到通知?
谢谢!
EQu*_*per 10
我得到了同样的问题对我来说,我是用与反应,并希望看到谁从改变组件Send verification Email来Email Verified。我所做的是创建一个将reload方法包装在用户实例上的函数。这是一个承诺,所以当承诺实现时,我现在调用firebase.auth().currentUser函数 who get now update 重新加载的原因。我将所有这些与某些组件生命周期等相匹配。
const user = firebase.auth().currentUser;
user.reload().then(() => {
const refreshUser = firebase.auth().currentUser;
// do your stuff here
})
Run Code Online (Sandbox Code Playgroud)
重新加载的文档在那里。https://firebase.google.com/docs/reference/js/firebase.User#reload
希望可以帮助:)
| 归档时间: |
|
| 查看次数: |
3998 次 |
| 最近记录: |