【发布时间】:2019-03-14 14:26:06
【问题描述】:
我想用 firebase 函数实现一个函数,但问题是在 firebase 面板中它永远不会反映正在做某事。
这是我的函数代码,想法是从具有特定 id 的特定文档中获取所有数据。
exports.identifyusers=functions.https.onRequest((req, res) => {
var db = admin.firestore();
const key=req.query.key;
return db.collection("usuariosdinny").doc(key).get().then(snapshot => {
console.log("Correcto")
}).catch(reason => {
res.send(reason)
})
});
这是我调用函数时的部分:(这部分是一个正确的身份验证过程,用户我得到了 id 并将这个 id 发送给函数)
this.afAuth.auth.signInWithEmailAndPassword(userst.email,userst.password)
.then(res=>
{
console.log(this.afAuth.auth.currentUser.uid);
var tipo= firebase.functions().httpsCallable('identifyusers').arguments(this.afAuth.auth.currentUser.uid);
console.log(tipo);
if(tipo=="Cliente Dinny")
{
console.log("Es un cliente");
}
else{
console.log("No tiene permiso para")
}
}
//this.navCtrl.push(TabsControllerPage)&& loader.dismiss())
).catch(reject =>alert.present() && loader.dismiss());
}).catch(reject=>loader.dismiss());
感谢您的帮助。
【问题讨论】:
标签: typescript firebase ionic-framework firebase-authentication google-cloud-functions