@@ -8,7 +8,6 @@ import { Subscription } from 'rxjs';
88import { Location } from '@angular/common' ;
99import { PermissionService } from '../../../shared/services/permission.service' ;
1010import { PermissionRequest , PermissionType } from '../permission.model' ;
11- import { Organisation } from '@app/admin/organisation/organisation.model' ;
1211import { OrganisationResponse } from '../../organisation/organisation.model' ;
1312import { OrganisationService } from '../../../shared/services/organisation.service' ;
1413import { UserService } from '../../users/user.service' ;
@@ -49,7 +48,7 @@ export class PermissionEditComponent implements OnInit {
4948 private userService : UserService ,
5049 private applicationService : ApplicationService ,
5150 private location : Location
52- ) { }
51+ ) { }
5352
5453 ngOnInit ( ) : void {
5554 this . getOrganizations ( ) ;
@@ -93,7 +92,7 @@ export class PermissionEditComponent implements OnInit {
9392 ) ;
9493 }
9594
96- organizationChanged ( whatever ) {
95+ organizationChanged ( ) {
9796 this . getApplications ( this . permission . organizationId ) ;
9897 }
9998
@@ -152,7 +151,7 @@ export class PermissionEditComponent implements OnInit {
152151
153152 private update ( ) : void {
154153 this . permissionService . updatePermission ( this . permission , this . id ) . subscribe (
155- ( response ) => {
154+ ( ) => {
156155 this . routeBack ( ) ;
157156 } ,
158157 ( error ) => {
@@ -191,7 +190,7 @@ export class PermissionEditComponent implements OnInit {
191190 isOrganizationAdministrationPermission ( ) {
192191 return (
193192 this . permission . level ==
194- PermissionType . OrganizationApplicationPermissions ||
193+ PermissionType . OrganizationApplicationPermissions ||
195194 this . permission . level == PermissionType . Write ||
196195 this . permission . level == PermissionType . Read
197196 ) ;
@@ -208,8 +207,13 @@ export class PermissionEditComponent implements OnInit {
208207 private showError ( err : HttpErrorResponse ) {
209208 this . errorFields = [ ] ;
210209 this . errorMessages = [ ] ;
210+ if ( err ?. error ?. message == 'Internal server error' ) {
211+ this . errorMessage = 'Internal server error' ;
212+ return ;
213+ }
214+
211215 if ( err . error ?. message ?. length > 0 ) {
212- err . error . message [ 0 ] . children . forEach ( ( err ) => {
216+ err . error . message . forEach ( ( err ) => {
213217 this . errorFields . push ( err . property ) ;
214218 this . errorMessages = this . errorMessages . concat (
215219 Object . values ( err . constraints )
0 commit comments