native: fix key

This commit is contained in:
Johannes Jöns 2024-07-12 11:04:10 +02:00
parent 8d2cf83d33
commit 0619572c05

View file

@ -149,7 +149,7 @@ Rectangle {
text: qsTr("Delete")
Layout.preferredWidth: 100
onClicked: {
deleteLicense(model.key)
deleteLicense(model.id)
}
}
}
@ -205,7 +205,8 @@ Rectangle {
start: jsonResponse[i].licenses[ii].start ?? "Indefinitely",
end: jsonResponse[i].licenses[ii].end ?? "Indefinitely",
amount: jsonResponse[i].licenses[ii].amount ? jsonResponse[i].licenses[ii].amount.toString() : "∞",
key: jsonResponse[i].licenses[ii].id
key: jsonResponse[i].licenses[ii].key,
id: jsonResponse[i].licenses[ii].id
});
}
}
@ -240,9 +241,9 @@ Rectangle {
}
}
function deleteLicense(key) {
function deleteLicense(id) {
var xhr = new XMLHttpRequest();
xhr.open("DELETE", "https://api.clan-war.net/api/v1/licenses/" + key);
xhr.open("DELETE", "https://api.clan-war.net/api/v1/licenses/" + id);
xhr.setRequestHeader("Authorization", "Bearer " + authToken);
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {