From 8018365010e823f99fda8d3bd933753b1832a198 Mon Sep 17 00:00:00 2001 From: Dean Date: Fri, 28 Oct 2022 15:46:03 +0100 Subject: [PATCH] Ensure 'validationErrors' is checked for details field errors when parsing an error response on update --- .../backend/DataTable/modals/CreateEditUser.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte index a67330efa7..d18e8783d2 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditUser.svelte @@ -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 {