您好,我希望为每个用户在我的数据库中存储日期,因为我希望为每个用户创建一个包含UID的节点。将用户ID推送到firebase数据库时出错DB
我对此方法的认证服务:
signupCommerce(email: string, password: string){
return secondaryApp.auth().createUserWithEmailAndPassword(email, password).then(function(firebaseUser) {
console.log("User " + firebaseUser.uid + " created successfully!");
return firebaseUser.uid;
});
}
而且这种方法的DB服务:
createCommercePath(category:string,id:string, commerce:string, banner:string, logo: string, latitude:number, longitude:number){
this.db.database.ref().child(category).child(id).push({
name: commerce,
bannerUrl: banner,
logoUrl: logo,
lat: latitude,
lng: longitude
});
}
在我的组件我的形式调用此方法:
createCommerce(){
let commerceId = this.authService.signupCommerce(this.email, this.password);
this.db.createCommercePath(this.category, commerceId, this.commerce, this.bannerUrl, this.logoUrl, this.lat,this.lng);
}
我收到此错误:
Argument of type 'Promise<any>' is not assignable to parameter of type 'string'.
谢谢您的回答,我怎样才能得到验证服务的uid和推到DB。 –
孩子的方法需要一个字符串我不能通过一个Promise –
谢谢,那工程,但我不知道有什么区别。 –