mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 12:48:29 +00:00
Show human-readable error message on settings save fail
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -114,6 +114,7 @@ function setConfigValues(topic, key, value) {
|
||||
|
||||
function saveSettings() {
|
||||
var settings = {};
|
||||
utils.disableAll();
|
||||
$("[data-key]").each(function () {
|
||||
var key = $(this).data("key");
|
||||
var value = $(this).val();
|
||||
@@ -168,6 +169,7 @@ function saveSettings() {
|
||||
contentType: "application/json; charset=utf-8",
|
||||
})
|
||||
.done(function () {
|
||||
utils.enableAll();
|
||||
// Success
|
||||
utils.showAlert(
|
||||
"success",
|
||||
@@ -178,7 +180,10 @@ function saveSettings() {
|
||||
// Reload page
|
||||
location.reload();
|
||||
})
|
||||
.fail(function (data) {
|
||||
.fail(function (data, exception) {
|
||||
utils.enableAll();
|
||||
utils.showAlert("error", "", "Error while applying settings", data.responseText);
|
||||
console.log(exception); // eslint-disable-line no-console
|
||||
apiFailure(data);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user