From 9db2d058bc6b186faa50c13ca8621b0c7b1fd665 Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Thu, 19 Apr 2018 10:24:17 +0200 Subject: [PATCH] mgr/dashboard: Do not show notifications for HTTP 409 errors. Signed-off-by: Volker Theile --- .../app/shared/services/api-interceptor.service.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.ts index d412119bbc289..ed5ea8fac9466 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.ts @@ -26,6 +26,7 @@ export class ApiInterceptorService implements HttpInterceptor { intercept(request: HttpRequest, next: HttpHandler): Observable> { return next.handle(request).catch(resp => { if (resp instanceof HttpErrorResponse) { + let showNotification = true; switch (resp.status) { case 401: this.authStorageService.remove(); @@ -34,11 +35,15 @@ export class ApiInterceptorService implements HttpInterceptor { case 404: this.router.navigate(['/404']); break; + case 409: + showNotification = false; + break; + } + if (showNotification) { + this.notificationService.show(NotificationType.error, + resp.error.detail || '', + `${resp.status} - ${resp.statusText}`); } - this.notificationService.show( - NotificationType.error, - resp.error.detail || '', - `${resp.status} - ${resp.statusText}`); } // Return the error to the method that called it. return Observable.throw(resp); -- 2.39.5