From 0143bdfe146fb8cb28ee4be9ffb19a9b26e6df11 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Wed, 30 Aug 2017 11:50:11 +0200 Subject: [PATCH] UI: fix updateServerConfig error handling --- src/Jackett/Content/custom.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Jackett/Content/custom.js b/src/Jackett/Content/custom.js index 96da99443..25d3048ee 100644 --- a/src/Jackett/Content/custom.js +++ b/src/Jackett/Content/custom.js @@ -1111,17 +1111,17 @@ function bindUIButtons() { omdbkey: jackett_omdb_key }; api.updateServerConfig(jsonObject, function (data) { - if (data !== undefined && data.result == "error") { - doNotify("Error: " + data.error, "danger", "glyphicon glyphicon-alert"); + doNotify("Redirecting you to complete configuration update..", "success", "glyphicon glyphicon-ok"); + window.setTimeout(function () { + window.location.reload(true); + }, 3000); + }).fail(function (data) { + if (data.responseJSON !== undefined && data.responseJSON.result == "error") { + doNotify("Error: " + data.responseJSON.error, "danger", "glyphicon glyphicon-alert"); return; } else { - doNotify("Redirecting you to complete configuration update..", "success", "glyphicon glyphicon-ok"); - window.setTimeout(function () { - window.location.reload(true); - }, 3000); + doNotify("Request to Jackett server failed", "danger", "glyphicon glyphicon-alert"); } - }).fail(function () { - doNotify("Request to Jackett server failed", "danger", "glyphicon glyphicon-alert"); }); });