我正在尝试使用firebase中的isEmailVerified函数,但我得到了错误
user.emailVerified不是函数
import * as firebase from 'firebase';
@IonicPage()
@Component({
selector: 'page-login',
templateUrl: 'login.html',
})
export class LoginPage {
user = {} as User
async login(user: User){
try{
this.afAuth.auth.signInWithEmailAndPassword(user.email,user.password)
.then(res => {
//check if user has made profile if not send to profile setup page
let user = firebase.auth().currentUser;
if(user.isEmailVerified()){
console.log("Email is verified");
}
}catch(e){
console.log(e);
}
}
}
答案 0 :(得分:3)
emailVerified
布尔
如果用户的电子邮件地址已经过验证,则为真。
所以setSize
是一个属性,而不是一个方法(因此它不可调用)。您可以像这样更改代码:
emailVerified
答案 1 :(得分:2)
使用just - user.isEmailVerified,如下所示:
if(user.isEmailVerified){
console.log("Email is verified");
}