diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-10-25 18:03:31 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-10-25 18:03:31 -0500 |
| commit | a558ed524154ccef63a56c8335b6984a16a78bd5 (patch) | |
| tree | 6763500f99d8b00baa8c944c976bb218b2db30d9 /src | |
| parent | 600b0b5d484c4c6959f2d527a2c77e3faa1f28ef (diff) | |
| download | slskd-a558ed524154ccef63a56c8335b6984a16a78bd5.tar.gz | |
don't rely on state for passing data
Diffstat (limited to 'src')
| -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); } } }; |
