Javascript 向firebase上的用户添加额外详细信息
我试图在用户通过firebase注册后向他们添加诸如名字和姓氏之类的详细信息,尽管我遇到了一些麻烦。用户似乎是在auth部分创建的,但用户节点不是在数据库上创建的Javascript 向firebase上的用户添加额外详细信息,javascript,firebase,react-native,firebase-realtime-database,firebase-authentication,Javascript,Firebase,React Native,Firebase Realtime Database,Firebase Authentication,我试图在用户通过firebase注册后向他们添加诸如名字和姓氏之类的详细信息,尽管我遇到了一些麻烦。用户似乎是在auth部分创建的,但用户节点不是在数据库上创建的 signup() { this.setState({ // When waiting for the firebase server show the loading indicator. loading: true }); // Make a call to firebase to c
signup() {
this.setState({
// When waiting for the firebase server show the loading indicator.
loading: true
});
// Make a call to firebase to create a new user.
firebaseApp.auth().createUserWithEmailAndPassword(
this.state.email,
this.state.password).then(() => {
this.setState({
// Clear out the fields when the user logs in and hide the progress indicator.
email: '',
password: '',
loading: false
})
this.userFirebase.child(firebase.auth().currentUser.uid).update({
first_name: this.state.first_name,
last_name: this.state.last_name,
})
NavigationActions.Venue()
}).catch((error) => {
// Leave the fields filled when an error occurs and hide the progress indicator.
this.setState({
loading: false
});
Alert.alert('Hold on to your baristas, first a few basics!', error.message );
});
}
如果单步执行代码,是否会进入
update()
调用?如果是,您的JavaScript控制台中是否显示任何错误消息?perfect找到它,使用的是firebase而不是firebaseApp,并且权限设置不正确