Ensure 'validationErrors' is checked for details field errors when parsing an error response on update
This commit is contained in:
parent
6719bd2c69
commit
1418790756
|
@ -70,7 +70,11 @@
|
|||
.map(([key, error]) => ({ dataPath: key, message: error }))
|
||||
.flat()
|
||||
}
|
||||
} else if (error.status === 400) {
|
||||
} else if (error.status === 400 && response?.validationErrors) {
|
||||
errors = Object.keys(response.validationErrors).map(field => ({
|
||||
message: `${field} ${response.validationErrors[field][0]}`,
|
||||
}))
|
||||
} else {
|
||||
errors = [{ message: response?.message || "Unknown error" }]
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue