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 5275c64f42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

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