Delete unnecessary red banners 84/6884/1
authormaximesson <maxime.bonneau@est.tech>
Thu, 7 Oct 2021 09:15:32 +0000 (11:15 +0200)
committermaximesson <maxime.bonneau@est.tech>
Mon, 18 Oct 2021 06:42:23 +0000 (08:42 +0200)
Change-Id: I078abbc7b27e97db8a439851f292bf4aeabcf187
Issue-ID: NONRTRIC-599
Signed-off-by: maximesson <maxime.bonneau@est.tech>
webapp-frontend/src/app/interceptor.mock.ts
webapp-frontend/src/app/interceptor.ts

index 844513b..abb45ce 100644 (file)
@@ -195,17 +195,17 @@ const urls = [
     url: CONSUMER_PATH + "/info-jobs/job3/status",
     json: job3Status,
   },
-    {
-        url: '/a1-policy/v2/configuration',
-        json: ricconfig
-    }
+  {
+    url: '/a1-policy/v2/configuration',
+    json: ricconfig
+  }
 ];
 
 @Injectable()
 export class HttpMockRequestInterceptor implements HttpInterceptor {
   private toggleTypes = true;
 
-  constructor(private injector: Injector) {}
+  constructor(private injector: Injector) { }
 
   intercept(
     request: HttpRequest<any>,
@@ -229,7 +229,7 @@ export class HttpMockRequestInterceptor implements HttpInterceptor {
       }
     }
 
-  if (result) {
+    if (result) {
       console.log(
         "Mock answering http call :" + request.method + " " + request.url,
         request.method === "PUT" ? request.body : null
index 65ce887..3bceb5e 100644 (file)
@@ -27,18 +27,27 @@ import { NotificationService } from '@services/ui/notification.service';
 
 @Injectable()
 export class HttpRequestInterceptor implements HttpInterceptor {
-    constructor(private notificationService: NotificationService) {}
+    constructor(private notificationService: NotificationService) { }
 
     intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
         console.log('Interceptor Invoked' + request.url);
-        return next.handle(request).pipe(
-            catchError((error: HttpErrorResponse) => {
-                console.error("Error from error interceptor", error);
+        if (!request.url.includes("info-jobs")) {
+            return next.handle(request).pipe(
+                catchError((error: HttpErrorResponse) => {
+                    console.error("Error from error interceptor", error);
 
-                // show dialog for error message
-                this.notificationService.error(error.message);
-                return throwError(error);
-            })
-        ) as Observable<HttpEvent<any>>;
+                    // show dialog for error message
+                    this.notificationService.error(error.message);
+                    return throwError(error);
+                })
+            ) as Observable<HttpEvent<any>>;
+        } else {
+            return next.handle(request).pipe(
+                catchError((error: HttpErrorResponse) => {
+                    console.error("Error from error interceptor", error);
+                    return throwError(error);
+                })
+            ) as Observable<HttpEvent<any>>;
+        }
     }
 }