Merge pull request #8437 from Budibase/fix/edit-user-validation

User table validation messaging
This commit is contained in:
Martin McKeaveney 2022-10-31 10:35:44 +00:00 committed by GitHub
commit a0ae4fc7f4
1 changed files with 5 additions and 1 deletions

View File

@ -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 {