From 52b00f63e631f96f8b5e5823320b76a85f75be48 Mon Sep 17 00:00:00 2001
From: Helmut Hutzler <helmut.hutzler@th-nuernberg.de>
Date: Thu, 17 Nov 2022 15:34:05 +0100
Subject: [PATCH] Fixing some Angular 14 Upgrade errors

---
 package.json                    | 6 ++----
 src/app/account.service.ts      | 9 +++------
 src/app/auth-config.module.ts   | 3 +--
 src/environments/environment.ts | 8 ++++----
 4 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/package.json b/package.json
index b07448a..833bf65 100644
--- a/package.json
+++ b/package.json
@@ -16,13 +16,11 @@
     "@angular/compiler": "^14.2.8",
     "@angular/core": "^14.2.8",
     "@angular/forms": "^14.2.8",
+    "@angular/material": "^14.2.7",
     "@angular/platform-browser": "^14.2.8",
     "@angular/platform-browser-dynamic": "^14.2.8",
     "@angular/router": "^14.2.8",
     "angular-auth-oidc-client": "14.1.5",
-    "primeflex": "^3.2.1",
-    "primeicons": "^6.0.1",
-    "primeng": "^14.1.2",
     "rxjs": "~6.6.0",
     "tslib": "^2.3.0",
     "zone.js": "~0.11.4"
@@ -41,4 +39,4 @@
     "karma-jasmine-html-reporter": "~1.7.0",
     "typescript": "~4.6.4"
   }
-}
+}
\ No newline at end of file
diff --git a/src/app/account.service.ts b/src/app/account.service.ts
index b36989a..9b84f1d 100644
--- a/src/app/account.service.ts
+++ b/src/app/account.service.ts
@@ -1,8 +1,8 @@
 import {Injectable, OnDestroy, OnInit} from '@angular/core';
 import {MessageService} from "./message.service";
 import {HttpClient, HttpErrorResponse, HttpHeaders} from "@angular/common/http";
-import {map, Observable, of, tap, throwError} from 'rxjs';
-import { retry, catchError } from 'rxjs/operators';
+import { Observable, of, throwError} from 'rxjs';
+import { retry, catchError, tap ,map } from 'rxjs/operators';
 import { Account } from './account';
 import { environment } from '../environments/environment';
 
@@ -17,10 +17,7 @@ export class AccountService implements  OnInit {
   ngOnInit() {
     this.logHeader = "[AccountService:ngOnInit()] ";
     this.messageService.add(this.logHeader + "\n   keycloakURL: " + environment.keycloakURL
-                                           + "\n   apiURL     : " + environment.apiURL
-                                           + "\n   secureRoute: " + environment.secureRoute  + "\n");
-
-    // this.messageService.add(this.logHeader + 'Initial call to isAuthenticated: ' + this.isAuthenticated);
+                                           + "\n   apiURL     : " + environment.apiURL + "\n");
   }
   private logHeader = ''
   private apiURL = environment.apiURL;
diff --git a/src/app/auth-config.module.ts b/src/app/auth-config.module.ts
index 37c45b1..fe99a2f 100644
--- a/src/app/auth-config.module.ts
+++ b/src/app/auth-config.module.ts
@@ -11,7 +11,6 @@ import { environment } from '../environments/environment';
         logLevel: LogLevel.Debug,
            // Do not change historyCleanupOff to true : https://github.com/damienbod/angular-auth-oidc-client/issues/1318
         historyCleanupOff: false,
-        // authority: 'https://kube-master.informatik.fh-nuernberg.de:8087/auth/realms/rzldap',
         authority: environment.keycloakURL +  'realms/RBAC',
         redirectUrl: window.location.origin,
         postLogoutRedirectUri: window.location.origin,
@@ -25,7 +24,7 @@ import { environment } from '../environments/environment';
         // startCheckSession: true,
         ignoreNonceAfterRefresh: true,
         // routes that get added a bearer token by  HTTP_INTERCEPTORS provided by angular-auth-oidc-client lib'
-        secureRoutes: [  environment.secureRoute ]
+        secureRoutes: [  environment.apiURL ]
       },
     }),
   ],
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index 071aea2..7b8f89e 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -5,11 +5,11 @@
 
 export const environment = {
   production: false,
-     keycloakURL: 'http://localhost:8280/auth/',
+   //  keycloakURL: 'http://localhost:8280/auth/',
   //   keycloakURL: '/auth/',
-  //   keycloakURL: 'https://kube-master-h1.informatik.fh-nuernberg.de:/auth/',
-     apiURL: 'http://localhostxx:8080/api',
-     secureRoute: 'http://localhost:8080/'
+     keycloakURL: 'https://kube-master-h1.informatik.fh-nuernberg.de/auth/',
+     apiURL: 'http://localhost:8080/api',
+     // secureRoute: 'http://localhost:8080/api'
 };
 
 /*
-- 
GitLab