Fix handleSave function syntax errors
This commit is contained in:
1 parent
1494df9eb3
commit
3ce40b1ab8
2 files changed
+1207
-488
No files matched your search
Generated
+1202
-474
File diff suppressed because it is too large.
Load diff
@@ -153,20 +153,6 @@ const Settings = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate
|
|
||||||
const { error } = settingsValidation.validate(newSettingsData.settings, {
|
|
||||||
abortEarly: false,
|
|
||||||
});
|
|
||||||
if (!error || error.details.length === 0) {
|
|
||||||
setErrors({});
|
|
||||||
} else {
|
|
||||||
const newErrors = {};
|
|
||||||
error.details.forEach((err) => {
|
|
||||||
newErrors[err.path[0]] = err.message;
|
|
||||||
});
|
|
||||||
setErrors(newErrors);
|
|
||||||
}
|
|
||||||
|
|
||||||
setSettingsData(newSettingsData);
|
setSettingsData(newSettingsData);
|
||||||
|
|
||||||
// Update Redux immediately for UI feedback
|
// Update Redux immediately for UI feedback
|
||||||
@@ -176,6 +162,11 @@ const Settings = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
|
// Validate
|
||||||
|
const { error } = settingsValidation.validate(settingsData.settings, {
|
||||||
|
abortEarly: false,
|
||||||
|
});
|
||||||
|
if (!error || error.details.length === 0) {
|
||||||
setErrors({});
|
setErrors({});
|
||||||
} else {
|
} else {
|
||||||
const newErrors = {};
|
const newErrors = {};
|
||||||
|
|||||||
Reference in new issue
Block a user