I'm a beginner in reactjs, I'm having trouble displaying error messages from the API, the error message looks in this way
"[ErrorDetail(string=' name already exists!', code='invalid')]"
I only need the "string" value here, so I'm looking for a way to extract it from the error message above.
in react, using
const errMsg = err?.response?.data?.error?.message
this.setState(common.showSnackbar(true, errMsg || err.message || err, 'error'))
give me if there is a solution to change message from this
[ErrorDetail(string=' name already exists!', code='invalid')]
to
'name already exists!'