From 4b232cc0e4fb3f9b8221a02c352dd5441bbb0120 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Mon, 23 Dec 2019 17:33:43 +0100 Subject: [PATCH] Use location for path --- projects/common/src/fm/shared/app.config.factory.ts | 6 +++--- projects/common/src/fm/shared/app.config.ts | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/projects/common/src/fm/shared/app.config.factory.ts b/projects/common/src/fm/shared/app.config.factory.ts index 8da019c..52df81c 100644 --- a/projects/common/src/fm/shared/app.config.factory.ts +++ b/projects/common/src/fm/shared/app.config.factory.ts @@ -1,4 +1,5 @@ import { Injector } from '@angular/core'; +import { Location} from '@angular/common'; import { Router,UrlSerializer } from '@angular/router'; import { AuthConfig, OAuthService, JwksValidationHandler, OAuthErrorEvent } from 'angular-oauth2-oidc'; import { AppConfig } from "./app.config"; @@ -26,9 +27,8 @@ export function appConfigFactory(injector:Injector, appConfig: AppConfig, oauthS return new Promise((res) => { res(true); }) }; oauthService.setupAutomaticSilentRefresh(); - let router = injector.get(Router); - var urlTree = router.parseUrl(window.location.href); - var urlPath = window.location.pathname; + let location = injector.get(Location); + var urlPath =location.path(); oauthService.loadDiscoveryDocument().then(() => { oauthService.tryLogin({ onTokenReceived: (info) => { diff --git a/projects/common/src/fm/shared/app.config.ts b/projects/common/src/fm/shared/app.config.ts index 4ede6a8..309f955 100644 --- a/projects/common/src/fm/shared/app.config.ts +++ b/projects/common/src/fm/shared/app.config.ts @@ -23,7 +23,6 @@ export class AppConfig { public load(): Promise { var url = this.location.prepareExternalUrl('/configuration.json'); - if(url.startsWith("#")) url='file:///android_asset/www/configuration.json'; // hack for cordova return this.httpClient.get(url) .toPromise() .then(data => {