Fix Bug 2340: Invalid error message in UI for some role permission
[osm/NG-UI.git] / src / services / RestService.ts
index bea559a..d3d9ea0 100644 (file)
@@ -141,8 +141,11 @@ export class RestService {
                     this.notifierService.notify('error', err.error.detail !== undefined ?
                         err.error.detail : this.translateService.instant('HTTPERROR.401'));
                 }
-                this.activeModal.dismissAll();
+            } else {
+                this.notifierService.notify('error', err?.error?.detail !== undefined ?
+                    err?.error?.detail : this.translateService.instant('HTTPERROR.401'));
             }
+            this.activeModal.dismissAll();
         } else if (err.error.status === HttpStatus.BAD_REQUEST) {
             this.notifierService.notify('error', err.error.detail !== undefined ?
                 err.error.detail : this.translateService.instant('HTTPERROR.400'));
@@ -177,7 +180,7 @@ export class RestService {
         });
         return {
             url: apiURL,
-            httpOptions: {headers : apiHeaders}
+            httpOptions: { headers: apiHeaders }
         };
     }
 }