feat: add error handling and toast type indicators to backend config save operation
This commit is contained in:
parent
1baad8eab9
commit
98481b074a
@ -3118,15 +3118,20 @@
|
||||
watcher_debounce: _getFieldNum("cfg-watcher-debounce", 2.0),
|
||||
};
|
||||
try {
|
||||
await fetch("/api/config", {
|
||||
const res = await fetch("/api/config", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
showToast("Configuration backend sauvegardée");
|
||||
if (res.ok) {
|
||||
showToast("Configuration backend sauvegardée", "success");
|
||||
} else {
|
||||
const errorData = await res.json().catch(() => ({}));
|
||||
showToast(errorData.detail || "Erreur de sauvegarde", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to save backend config:", err);
|
||||
showToast("Erreur de sauvegarde");
|
||||
showToast("Erreur de sauvegarde", "error");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user