本文整理汇总了TypeScript中@eg/core/auth.service.AuthService.testAuthToken方法的典型用法代码示例。如果您正苦于以下问题:TypeScript service.AuthService.testAuthToken方法的具体用法?TypeScript service.AuthService.testAuthToken怎么用?TypeScript service.AuthService.testAuthToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@eg/core/auth.service.AuthService
的用法示例。
在下文中一共展示了service.AuthService.testAuthToken方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: resolve
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<any> {
// Staff cookies stay in /$base/staff/
// NOTE: storing session data at '/' so it can be shared by
// Angularjs apps.
this.store.loginSessionBasePath = '/';
// ^-- = this.ngLocation.prepareExternalUrl('/staff');
// Not sure how to get the path without params... using this for now.
const path = state.url.split('?')[0];
if (path === '/staff/login') {
return of(true);
}
const observable: Observable<any>
= Observable.create(o => this.observer = o);
this.auth.testAuthToken().then(
tokenOk => {
this.confirmStaffPerms().then(
hasPerms => {
this.auth.verifyWorkstation().then(
wsOk => {
this.loadStartupData()
.then(ok => this.observer.complete());
},
wsNotOk => this.handleInvalidWorkstation(path)
);
},
hasNotPerms => {
this.observer.error(
'User does not have staff permissions');
}
);
},
tokenNotOk => this.handleInvalidToken(state)
);
return observable;
}