-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional icons for new statuses & Change Password Requirement for IEC Security #375
Conversation
const handleError = (error, action) => { | ||
try { | ||
if (error instanceof Error) { | ||
const errorMessage = error.message; | ||
|
||
const parsedError = JSON.parse(errorMessage); | ||
const firstErrorMessage = parsedError.errors[0]?.description; | ||
setErrorMessage(firstErrorMessage); | ||
} else { | ||
console.log(`${action}: Received non-Error object:`, error); | ||
} | ||
} catch (e) { | ||
console.log(`${action}: Failed to parse error response.`, e); | ||
} | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why create a function inside a function? it seems better to split the functionality
if (isNew) { | ||
commitAddedRows({ rowIds }); | ||
onSave(editedRow, isNew); | ||
} else { | ||
onSave(editedRow); | ||
if (errorMessage !== '') { | ||
onSave(editedRow); | ||
stopEditRows({ rowIds }); | ||
commitChangedRows({ rowIds }); | ||
} else { | ||
onSave(editedRow); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you dont need to call onSave
three times. just put onSave
in the last line.
https://dhigroup.visualstudio.com/Domain%20Services%20Planning/_workitems/edit/97241
https://dhigroup.visualstudio.com/Domain%20Services%20Planning/_workitems/edit/96620/