如何解决ionic应用程序中Google电子邮件的本地存储
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);
});
}
这是Google登录代码,我想将电子邮件本地存储,但是我尝试了此代码
localStorage.setItem('email',result.user.email);
但无法在本地存储电子邮件,也无法登录,因为它本身会刷新。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。