Refactoring for landingpage support
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -11,27 +11,12 @@ import { IAuthconfigFactory } from './authconfigFactory';
|
||||
export function appConfigFactory(injector:Injector, appConfig: AppConfig, oauthService: OAuthService, authconfigFactory:IAuthconfigFactory,authStorage:OAuthStorage,itemtypeService:ItemTypeService): () => Promise<any> {
|
||||
return (): Promise<any> => {
|
||||
return new Promise((resolve,reject) => {
|
||||
appConfig.load().then(() => {
|
||||
oauthService.events.subscribe((event) => {
|
||||
console.debug(event.type);
|
||||
if (event.type == 'token_error' || event.type == 'silent_refresh_timeout' || event.type == 'logout') {
|
||||
let e = event as OAuthErrorEvent;
|
||||
let p = e.params as any;
|
||||
if (event.type == 'silent_refresh_timeout' || event.type == 'logout' || (p.error && p.error == 'login_required')) {
|
||||
let router = injector.get(Router);
|
||||
console.debug("Session expired");
|
||||
router.navigate(['loggedout'], { queryParams: { redirectTo: router.url } });
|
||||
}
|
||||
}
|
||||
});
|
||||
appConfig.load().then(() => {
|
||||
oauthService.configure(authconfigFactory.getAuthConfig(appConfig));
|
||||
oauthService.setStorage(authStorage);
|
||||
oauthService.setupAutomaticSilentRefresh();
|
||||
}).then(() => oauthService.loadDiscoveryDocument()
|
||||
).then(() => {
|
||||
itemtypeService.load(appConfig).then(() => resolve()).catch(() => reject());
|
||||
})
|
||||
).then(() => resolve()).catch(() => reject());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user