火基地认证是集成在一个角应用程序。即使登录到应用程序,点击一个url或路由直接在一个新的选项卡或浏览器的同一选项卡,铬,例如http://localhost:4200/landing再次进入登录页面。
如果登录页面已经登录,是否有方法不跳过登录页?
复制步骤
Expected:它停留在http://localhost:4200/landing
实际:它可以追溯到http://localhost:4200/login
发布于 2018-07-13 03:20:51
我认为需要在下面进行修改。
constructor(private _firebaseAuth: AngularFireAuth, private router: Router) {
this.user = _firebaseAuth.authState;
this.user.subscribe(
(user) => {
if (user) {
this.userDetails = user;
// Set the UserId
localStorage.setItem('userId', user.uid);
} else {
this.userDetails = null;
}
}
);
}
isLoggedIn() {
if (this.userDetails == null) {
// Check the UserId
if (localStorage.getItem('userId')) {
return true;
}
return false;
} else {
return true;
}
}https://stackoverflow.com/questions/51276498
复制相似问题