forked from MarseyWorld/MarseyWorld
dont grey out the "buy" button in shop
parent
3bb3f0d087
commit
3295214bf3
|
@ -33,8 +33,12 @@ function createXhrWithFormKey(url, form=new FormData(), method='POST') {
|
||||||
}
|
}
|
||||||
|
|
||||||
function postToast(t, url, data, extraActionsOnSuccess, extraActionsOnFailure) {
|
function postToast(t, url, data, extraActionsOnSuccess, extraActionsOnFailure) {
|
||||||
t.disabled = true;
|
const is_shop = t.id && t.id.startsWith('buy-')
|
||||||
t.classList.add("disabled");
|
|
||||||
|
if (!is_shop) {
|
||||||
|
t.disabled = true;
|
||||||
|
t.classList.add("disabled");
|
||||||
|
}
|
||||||
|
|
||||||
let form = new FormData();
|
let form = new FormData();
|
||||||
if (typeof data === 'object' && data !== null) {
|
if (typeof data === 'object' && data !== null) {
|
||||||
|
@ -46,7 +50,7 @@ function postToast(t, url, data, extraActionsOnSuccess, extraActionsOnFailure) {
|
||||||
xhr[0].onload = function() {
|
xhr[0].onload = function() {
|
||||||
const success = xhr[0].status >= 200 && xhr[0].status < 300;
|
const success = xhr[0].status >= 200 && xhr[0].status < 300;
|
||||||
|
|
||||||
if (!(extraActionsOnSuccess == reload && success)) {
|
if (!(extraActionsOnSuccess == reload && success && !is_shop)) {
|
||||||
t.disabled = false;
|
t.disabled = false;
|
||||||
t.classList.remove("disabled");
|
t.classList.remove("disabled");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue