当用户成功登录时,我会被重定向到我的主页面(我想要的),但它会一直保持刷新状态。知道原因是什么吗?
代码:
firebaseApp.auth().onAuthStateChanged(user => {
if(user){
console.log('user is signed in', user);
window.location='/';
}else{
console.log('user is NOT signed in');
}
})
答案 0 :(得分:0)
firebaseApp.auth().onAuthStateChanged(user => {
if(user){
console.log('user is signed in', user);
if(window.location.href != "/"){
window.location='/';
}
}else{
console.log('user is NOT signed in');
}
})