本文整理匯總了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;
}