suppress "Something went wrong, sorry." when the management daemon's api key has changed
This commit is contained in:
parent
2f952a7915
commit
82851d6d2d
1 changed files with 7 additions and 2 deletions
|
@ -277,7 +277,7 @@ function ajax(options) {
|
|||
if (!old_error)
|
||||
show_modal_error("Error", "Something went wrong, sorry.")
|
||||
else
|
||||
old_error(jqxhr.responseText);
|
||||
old_error(jqxhr.responseText, jqxhr);
|
||||
};
|
||||
is_ajax_loading = true;
|
||||
$.ajax(options);
|
||||
|
@ -312,6 +312,11 @@ function api(url, method, data, callback, callback_error) {
|
|||
return output;
|
||||
}
|
||||
|
||||
function default_error(text, xhr) {
|
||||
if (xhr.status != 403) // else handled below
|
||||
show_modal_error("Error", "Something went wrong, sorry.")
|
||||
}
|
||||
|
||||
ajax({
|
||||
url: "/admin" + url,
|
||||
method: method,
|
||||
|
@ -325,7 +330,7 @@ function api(url, method, data, callback, callback_error) {
|
|||
'Basic ' + base64encode(api_credentials[0] + ':' + api_credentials[1]));
|
||||
},
|
||||
success: callback,
|
||||
error: callback_error,
|
||||
error: callback_error || default_error,
|
||||
statusCode: {
|
||||
403: function(xhr) {
|
||||
// Credentials are no longer valid. Try to login again.
|
||||
|
|
Loading…
Reference in a new issue