Javascript 错误:无法读取属性';更新配置文件';未定义的
我正在开发一个应用程序,我想实现这一点。当一个用户登录时,我想获取他的用户名和photoURL并存储在firebase中Javascript 错误:无法读取属性';更新配置文件';未定义的,javascript,firebase,firebase-authentication,Javascript,Firebase,Firebase Authentication,我正在开发一个应用程序,我想实现这一点。当一个用户登录时,我想获取他的用户名和photoURL并存储在firebase中 handleSubmit=(event)=>{ event.preventDefault(); if(this.isFormValid()){ this.setState({errors:[],loading:true}); firebase .auth() .createUserWithEmai
handleSubmit=(event)=>{
event.preventDefault();
if(this.isFormValid()){
this.setState({errors:[],loading:true});
firebase
.auth()
.createUserWithEmailAndPassword(this.state.email,this.state.password)
.then(createdUser =>{
console.log(createdUser);
createdUser.user
.updateProfile({
displayName:this.state.username,
photoURL:`http://gravatar.com/avatar/${md5(createdUser.user.email)}?d=identicon`
})
.then(()=>{
this.saveUser(createdUser).then(()=>{
console.log('user saved');
});
})
.catch(err=>{
console.log(err);
this.setState({errors:this.state.errors.concat(err),loading:false});
})
})
.catch(err=>{
console.error(err);
this.setState({errors:this.state.errors.concat(err),loading:false})
})
}
}
有人知道我为什么会犯这个错误吗
错误和console.log(CreatedUser)的输出:
我没有立即发现出了什么问题。您能否显示从
console.log(createdUser)获得的输出代码>?createdUser.user
未定义mybe您应该执行的操作:createdUser.updateProfile
,