fix lottery breaking bc of 1882653da6

master
Aevann 2023-08-13 17:06:32 +03:00
parent 947c75d4bc
commit f0e40534b0
2 changed files with 3 additions and 3 deletions

View File

@ -25,9 +25,9 @@ function showToast(success, message) {
bootstrap.Toast.getOrCreateInstance(document.getElementById(element)).show();
}
function createXhrWithFormKey(url, form=new FormData()) {
function createXhrWithFormKey(url, form=new FormData(), method='POST') {
const xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.open(method, url);
xhr.setRequestHeader('xhr', 'xhr');
if (!form) form = new FormData();
form.append("formkey", formkey());

View File

@ -53,7 +53,7 @@ function handleLotteryRequest(uri, method, callback = () => {}) {
const form = new FormData();
form.append("formkey", formkey());
form.append("quantity", purchaseQuantity);
const xhr = createXhrWithFormKey(`/lottery/${uri}`, method, form);
const xhr = createXhrWithFormKey(`/lottery/${uri}`, form, method);
xhr[0].onload = handleLotteryResponse.bind(null, xhr[0], method, callback);
xhr[0].send(xhr[1]);
}