Ensure 'validationErrors' is checked for details field errors when parsing an error response on update
This commit is contained in:
parent
074008b499
commit
8018365010
|
@ -70,7 +70,11 @@
|
||||||
.map(([key, error]) => ({ dataPath: key, message: error }))
|
.map(([key, error]) => ({ dataPath: key, message: error }))
|
||||||
.flat()
|
.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" }]
|
errors = [{ message: response?.message || "Unknown error" }]
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue