Skip to content

Commit

Permalink
fix: fix ForbiddenError returning information about record
Browse files Browse the repository at this point in the history
  • Loading branch information
dziraf committed Aug 27, 2024
1 parent 6ab01b5 commit 98ebe1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/interfaces/record-json.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*/
Expand Down

0 comments on commit 98ebe1c

Please sign in to comment.