Use location for path
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Willem Dantuma 2019-12-23 17:33:43 +01:00
parent 70fb5b42ec
commit 4b232cc0e4
2 changed files with 3 additions and 4 deletions

View File

@ -1,4 +1,5 @@
import { Injector } from '@angular/core'; import { Injector } from '@angular/core';
import { Location} from '@angular/common';
import { Router,UrlSerializer } from '@angular/router'; import { Router,UrlSerializer } from '@angular/router';
import { AuthConfig, OAuthService, JwksValidationHandler, OAuthErrorEvent } from 'angular-oauth2-oidc'; import { AuthConfig, OAuthService, JwksValidationHandler, OAuthErrorEvent } from 'angular-oauth2-oidc';
import { AppConfig } from "./app.config"; import { AppConfig } from "./app.config";
@ -26,9 +27,8 @@ export function appConfigFactory(injector:Injector, appConfig: AppConfig, oauthS
return new Promise<boolean>((res) => { res(true); }) return new Promise<boolean>((res) => { res(true); })
}; };
oauthService.setupAutomaticSilentRefresh(); oauthService.setupAutomaticSilentRefresh();
let router = injector.get(Router); let location = injector.get(Location);
var urlTree = router.parseUrl(window.location.href); var urlPath =location.path();
var urlPath = window.location.pathname;
oauthService.loadDiscoveryDocument().then(() => { oauthService.loadDiscoveryDocument().then(() => {
oauthService.tryLogin({ oauthService.tryLogin({
onTokenReceived: (info) => { onTokenReceived: (info) => {

View File

@ -23,7 +23,6 @@ export class AppConfig {
public load(): Promise<any> { public load(): Promise<any> {
var url = this.location.prepareExternalUrl('/configuration.json'); 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) return this.httpClient.get(url)
.toPromise() .toPromise()
.then(data => { .then(data => {