[英]Firebase: update user's profile not working
I am updating the Firebase user profile photoURL it's upadted in the store but not in the Firebase users db... when I signout then signin with this user, the photoURL is NOT changed 我正在更新它在商店中更新的Firebase用户配置文件photoURL,而不是在Firebase用户数据库中更新...当我注销然后用该用户登录时,photoURL不会更改
here is my store action 这是我的商店动作
updateProfilePhotoURL ({commit}, payload) {
const updateFBUserProfile = async (commit, payload) => {
commit(types.SET_LOADING, true)
let db = firebase.database()
const updatedData = {
photoURL: payload.photoURL
}
// Update the Firebase user profile too...
await db.ref('users/' + payload.uid).update(updatedData)
// Update the store profile too...
commit(types.UPDATE_PROFILE_PHOTO_URL, updatedData.photoURL)
return 'ok'
}
return new Promise((resolve, reject) => {
updateFBUserProfile(commit, payload)
.then(result => {
commit(types.SET_LOADING, false)
resolve(result)
}, error => {
console.log('ERROR: ', error)
reject(error)
})
})
}
where am I wrong ? 我哪里错了?
thanks for feedback 感谢您的反馈
According to question comments - I think your user has no permissions to write to db. 根据问题评论-我认为您的用户无权写入db。 You can check it with firebase.auth().currentUser
or check your Rules for database in Firebase Console. 您可以使用firebase.auth().currentUser
检查,也可以在Firebase控制台中检查数据库规则。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.