checkLogin(url: string): Observable<boolean>|boolean {
if (this.authService.login_data && (this.authService.login_data.userprofile || !this.authService.login_data.need_login)) {
console.log('gonna return observable true');
return Observable.of(true);
}
return this.authService.get_login_data()
.map(
data => {
this.authService.login_data = data;
if (data.userprofile || !data.need_login) {
console.log('in subscribe and gonna return observable true');
//return Observable.of(true);
return true;
}
this.authService.redirectUrl = url;
this.router.navigate(['/login']);
//return Observable.of(false);
return false;
},
error => { this.authService.errMsg = <any>error;}
);
}
我的代码有什么问题?我没有得到任何输出。如果我删除了mongo的部分,那么cron正在提供输出。