Ionic framework 在爱奥尼亚应用程序中本地存储谷歌电子邮件
这是在填写登录表时本地存储电子邮件的登录代码Ionic framework 在爱奥尼亚应用程序中本地存储谷歌电子邮件,ionic-framework,local-storage,google-signin,Ionic Framework,Local Storage,Google Signin,这是在填写登录表时本地存储电子邮件的登录代码 user:ProfileModel export class ProfileModel { image: string; name: string; role: string; description: string; email: string; provider: string; phoneNumber: string; } signInWithEmail() { this.authService .signInWit
user:ProfileModel
export class ProfileModel {
image: string;
name: string;
role: string;
description: string;
email: string;
provider: string;
phoneNumber: string;
}
signInWithEmail() {
this.authService
.signInWithEmail(
this.signInForm.value["email"],
this.signInForm.value["password"]
)
.then((user) => {
//to retrieve expenses from firebase for the email that is used upon signin
localStorage.setItem("email", this.signInForm.value["email"])
// navigate to user profile
this.redirectLoggedUserToProfilePage();
})
.catch((error) => {
this.submitError = error.message;
});
}
这是谷歌登录代码,我想本地存储电子邮件,但我尝试了此代码
googleSignIn() {
this.authService
.signInWithGoogle()
.then((result: any) => {
// localStorage.setItem('email', result.user.email);
if (result.additionalUserInfo) {
this.authService.setProviderAdditionalInfo(
result.additionalUserInfo.profile
);
}
;
this.redirectLoggedUserToProfilePage();
})
.catch((error) => {
// Handle Errors here.
console.log(error);
});
}
但无法本地存储电子邮件,并且无法登录,因为它会自行刷新
localStorage.setItem('email', result.user.email);