From ec7951dd147af21c7f854f0314bfbf83b12fce0b Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Fri, 8 Nov 2019 12:56:04 +0100 Subject: [PATCH] Fix 404 and provider error --- .../src/fm-map/components/map/map.component.ts | 16 ++++++++++++---- .../auth-callback/auth-callback.guard.ts | 4 +++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/projects/common-map/src/fm-map/components/map/map.component.ts b/projects/common-map/src/fm-map/components/map/map.component.ts index b400a5d..64a4bea 100644 --- a/projects/common-map/src/fm-map/components/map/map.component.ts +++ b/projects/common-map/src/fm-map/components/map/map.component.ts @@ -155,11 +155,10 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { let yCenter = parseFloat(params.get("yCenter")); let zoom = parseFloat(params.get("zoom")); let rotation = parseFloat(params.get("rotation")); - let baseLayer = params.get("baseLayer"); + let baseLayer = params.get("baseLayer")?params.get("baseLayer"):""; newMapState = { xCenter: xCenter, yCenter: yCenter, zoom: zoom, rotation: rotation, baseLayerCode: baseLayer } mapStateChanged = this.lastMapState != JSON.stringify(newMapState) && this.stateSetCount == 0; this.lastMapState = JSON.stringify(newMapState); - //console.log(`Base layer: ${newMapState.baseLayerCode}`) } if (params.has("queryState")) { let queryState = params.get("queryState"); @@ -224,8 +223,17 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { } replaceUrl(mapState: IMapState, queryState: IQueryState, replace: boolean = true) { - //console.log(`Replace url :${mapState.baseLayerCode}`) - this.router.navigate([".", mapState.xCenter.toFixed(5), mapState.yCenter.toFixed(5), mapState.zoom, mapState.rotation.toFixed(2), mapState.baseLayerCode, this.serializeService.serialize(queryState)], { replaceUrl: replace,relativeTo:this.route.parent }); + console.debug(`Replace url : Baselayer(${mapState.baseLayerCode}) Querystate(${this.serializeService.serialize(queryState)})`); + let parts =["."]; + parts.push(mapState.xCenter.toFixed(5)); + parts.push(mapState.yCenter.toFixed(5)); + parts.push( mapState.zoom.toFixed(0)); + parts.push( mapState.rotation.toFixed(2)); + if(mapState.baseLayerCode!="") { + parts.push(mapState.baseLayerCode); + parts.push( this.serializeService.serialize(queryState)); + this.router.navigate(parts, { replaceUrl: replace,relativeTo:this.route.parent }); + } } handleOnMoveEnd(event) { diff --git a/projects/common/src/fm/components/auth-callback/auth-callback.guard.ts b/projects/common/src/fm/components/auth-callback/auth-callback.guard.ts index 80e5002..14b70e6 100644 --- a/projects/common/src/fm/components/auth-callback/auth-callback.guard.ts +++ b/projects/common/src/fm/components/auth-callback/auth-callback.guard.ts @@ -3,7 +3,9 @@ import { Injectable } from '@angular/core'; import { OAuthService } from 'angular-oauth2-oidc'; import { } from '@angular/router'; -@Injectable() +@Injectable({ + providedIn: 'root', +}) export class AuthCallbackGuard implements CanActivate { constructor(private router$: Router,private oauthService$:OAuthService) {}