forked from rDrama/rDrama
show the error toast on errors, not the success toast
parent
3a11cfd603
commit
7620d8d8cd
|
@ -46,7 +46,7 @@ function postToastLoad(xhr, className, extraActionsOnSuccess, extraActionsOnErro
|
||||||
} else {
|
} else {
|
||||||
let message = data && data["error"] ? data["error"] : "Error, please try again later"
|
let message = data && data["error"] ? data["error"] : "Error, please try again later"
|
||||||
if (data && data["details"]) message = data["details"];
|
if (data && data["details"]) message = data["details"];
|
||||||
showToast(true, message);
|
showToast(false, message);
|
||||||
if (extraActionsOnError) extraActionsOnError(xhr);
|
if (extraActionsOnError) extraActionsOnError(xhr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,13 @@ function postPostToastNonShopActions(t, url, button1, button2, className) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* temporary compatability function. js styling wants us to use thisCase so any new things should use that */
|
||||||
function post_toast(t, url, button1, button2, classname, extra_actions, extra_actions_error) {
|
function post_toast(t, url, button1, button2, classname, extra_actions, extra_actions_error) {
|
||||||
prePostToastNonShopActions(t, url, button1, button2, classname)
|
postToast(t, url, button1, button2, classname, extra_actions, extra_actions_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
function postToast(t, url, button1, button2, className, extraActions, extraActionsError) {
|
||||||
|
prePostToastNonShopActions(t, url, button1, button2, className)
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open("POST", url);
|
xhr.open("POST", url);
|
||||||
xhr.setRequestHeader('xhr', 'xhr');
|
xhr.setRequestHeader('xhr', 'xhr');
|
||||||
|
@ -71,8 +76,8 @@ function post_toast(t, url, button1, button2, classname, extra_actions, extra_ac
|
||||||
form.append("formkey", formkey());
|
form.append("formkey", formkey());
|
||||||
|
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
postToastLoad(xhr, classname, extra_actions, extra_actions_error)
|
postToastLoad(xhr, className, extraActions, extraActionsError)
|
||||||
postPostToastNonShopActions(t, url, button1, button2, classname)
|
postPostToastNonShopActions(t, url, button1, button2, className)
|
||||||
};
|
};
|
||||||
xhr.send(form);
|
xhr.send(form);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue