rename postToastCallback2 to postToast redux

This commit is contained in:
justcool393 2023-07-23 09:03:44 -05:00
parent 4b564b8682
commit 5499d63cfd
2 changed files with 6 additions and 6 deletions

View file

@ -81,7 +81,7 @@ function expandDesktopImage(image) {
document.getElementById("desktop-expanded-image-wrap-link").href = image;
};
function postToastCallback2(targetElement, url, method, data, callbackFn) {
function postToast(targetElement, url, method, data, callbackFn) {
if (targetElement) { // disable element to avoid repeated requests
t.disabled = true;
t.classList.add("disabled");
@ -147,18 +147,18 @@ function postToastCallback2(targetElement, url, method, data, callbackFn) {
}
function postToastReload(t, url, method, data) {
postToastCallback2(t, url, method, data, (xhr) => location.reload());
postToast(t, url, method, data, (xhr) => location.reload());
}
function postToastSwitch(t, url, method, button1, button2, cssClass="d-none") {
postToastCallback2(t, url, method, data, (xhr) => {
postToast(t, url, method, data, (xhr) => {
document.getElementById(button1).classList.toggle(cssClass);
document.getElementById(button2).classList.toggle(cssClass);
})
}
function postToastSimple(t, url, method="POST", data=null) {
postToastCallback2(t, url, method, data, null);
postToast(t, url, method, data, null);
}
function post_toast2(t, url, button1, button2) {

View file

@ -34,7 +34,7 @@ function transferCoins(mobile=false) {
let transferred = amount - Math.ceil(amount*TRANSFER_TAX);
let username = document.getElementById('username').innerHTML
postToastCallback2(null, `/@${username}/transfer_coins`, "POST",
postToast(null, `/@${username}/transfer_coins`, "POST",
{
"amount": document.getElementById(mobile ? "coin-transfer-amount-mobile" : "coin-transfer-amount").value
},
@ -60,7 +60,7 @@ function transferBux(mobile=false) {
let amount = parseInt(document.getElementById("bux-transfer-amount").value);
let username = document.getElementById('username').innerHTML
postToastCallback2(null, `/@${username}/transfer_bux`, "POST",
postToast(null, `/@${username}/transfer_bux`, "POST",
{"amount": document.getElementById(mobile ? "bux-transfer-amount-mobile" : "bux-transfer-amount").value},
(xhr) => {
if(xhr.status == 200) {