【发布时间】:2020-12-13 21:07:54
【问题描述】:
我有一个使用 firebase 的身份验证功能,它只是 firebase 文档中的身份验证代码
export const signIn = (email,password) => {
firebase.auth().signInWithEmailAndPassword(email, password).then(()=>{
alert('Sign in Successful!')
}).catch(function(error) {
alert(error.message)
});
}
我这样称呼它
signIn(mail, password)
当我在我的代码中调用它时,它可以完美运行并且会出现正确的警报。但是,如果用户成功登录或未成功登录,我想从我的身份验证功能中实际接收一些东西,例如 True 或 False。有没有办法让我从我的函数或任何解决方法中接收这个值?
//evaluates to True if logged in successfully and vice versa
let authState = signIn(this.mail, this.password)
【问题讨论】:
标签: javascript firebase firebase-authentication