diff --git a/src/backend/services/action-error-handler/action-error-handler.ts b/src/backend/services/action-error-handler/action-error-handler.ts index dfaf1bb9a..b808e58fa 100644 --- a/src/backend/services/action-error-handler/action-error-handler.ts +++ b/src/backend/services/action-error-handler/action-error-handler.ts @@ -51,6 +51,13 @@ const actionErrorHandler = ( const recordJson = record?.toJSON?.(currentAdmin) + if (error instanceof ForbiddenError && recordJson) { + recordJson.id = null + recordJson.params = {} + recordJson.title = '' + recordJson.populated = {} + } + notice = { message: baseMessage, type: 'error', diff --git a/src/frontend/interfaces/record-json.interface.ts b/src/frontend/interfaces/record-json.interface.ts index e04277993..139378ff5 100644 --- a/src/frontend/interfaces/record-json.interface.ts +++ b/src/frontend/interfaces/record-json.interface.ts @@ -37,7 +37,7 @@ export interface RecordJSON { /** * Uniq Id of a record. Not present if the record is new (in NewAction) */ - id: string; + id: string | number | null; /** * Title of an record. Not present if the record is new (in NewAction) */