From 4210eb2e61a0f3577ac73528fa629e1a1fe30847 Mon Sep 17 00:00:00 2001 From: maximesson Date: Thu, 7 Oct 2021 11:15:32 +0200 Subject: [PATCH] Delete unnecessary red banners Change-Id: I078abbc7b27e97db8a439851f292bf4aeabcf187 Issue-ID: NONRTRIC-599 Signed-off-by: maximesson --- webapp-frontend/src/app/interceptor.mock.ts | 12 ++++++------ webapp-frontend/src/app/interceptor.ts | 27 ++++++++++++++++++--------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/webapp-frontend/src/app/interceptor.mock.ts b/webapp-frontend/src/app/interceptor.mock.ts index 844513b..abb45ce 100644 --- a/webapp-frontend/src/app/interceptor.mock.ts +++ b/webapp-frontend/src/app/interceptor.mock.ts @@ -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, @@ -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 diff --git a/webapp-frontend/src/app/interceptor.ts b/webapp-frontend/src/app/interceptor.ts index 65ce887..3bceb5e 100644 --- a/webapp-frontend/src/app/interceptor.ts +++ b/webapp-frontend/src/app/interceptor.ts @@ -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, next: HttpHandler): Observable> { 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>; + // show dialog for error message + this.notificationService.error(error.message); + return throwError(error); + }) + ) as Observable>; + } else { + return next.handle(request).pipe( + catchError((error: HttpErrorResponse) => { + console.error("Error from error interceptor", error); + return throwError(error); + }) + ) as Observable>; + } } } -- 2.16.6