diff options
| -rw-r--r-- | src/web/src/components/System/Options/EditModal.jsx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/web/src/components/System/Options/EditModal.jsx b/src/web/src/components/System/Options/EditModal.jsx index 6fc2af69..79fa4332 100644 --- a/src/web/src/components/System/Options/EditModal.jsx +++ b/src/web/src/components/System/Options/EditModal.jsx @@ -43,6 +43,7 @@ const EditModal = ({ onClose, open, theme }) => { const validate = async (newYaml) => { const response = await validateYaml({ yaml: newYaml }); setYamlError(response); + return response; }; const update = async (newYaml) => { @@ -51,14 +52,14 @@ const EditModal = ({ onClose, open, theme }) => { }; const save = async (newYaml) => { - await validate(newYaml); + const validationError = await validate(newYaml); - if (!yamlError) { + if (!validationError) { try { await updateYaml({ yaml: newYaml }); onClose(); } catch (nextUpdateError) { - setUpdateError(nextUpdateError.response.data); + setUpdateError(nextUpdateError?.response?.data ?? nextUpdateError?.message); } } }; |
