import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Layouts 2.15 import QtQuick.Controls 2.15 Window { SystemPalette { id: activeColors; colorGroup: SystemPalette.Active } SystemPalette { id: inactiveColors; colorGroup: SystemPalette.Inactive } SystemPalette { id: disabledColors; colorGroup: SystemPalette.Disabled } function getColors() { return dataScreen.active ? activeColors : inactiveColors; } id: dataScreen width: 640 height: 480 visible: true color: getColors().window title: qsTr("Alisa - Add License") property string authToken: "" TextField { id: nameT anchors { horizontalCenter: parent.horizontalCenter topMargin: 5 top: parent.top // Assuming there's no loginL defined in your code } placeholderText: qsTr("Name") Keys.onReturnPressed: keyT.focus = true } TextField { id: keyT anchors { horizontalCenter: parent.horizontalCenter topMargin: 5 top: nameT.bottom } placeholderText: qsTr("Key") Keys.onReturnPressed: amountT.focus = true } TextField { id: amountT anchors { horizontalCenter: parent.horizontalCenter topMargin: 5 top: keyT.bottom } placeholderText: qsTr("Amount") inputMethodHints: Qt.ImhDigitsOnly validator: DoubleValidator { bottom: 0 top: 1000000 } onTextChanged: { text = text.replace(/[^0-9]/g, "") } Keys.onReturnPressed: submitB.focus = true } Button { id: submitB anchors { horizontalCenter: parent.horizontalCenter topMargin: 5 top: amountT.bottom } text: qsTr("Submit") onClicked: submit() Keys.onReturnPressed: submit() } function submit() { var xhr = new XMLHttpRequest(); xhr.open("POST", "https://api.clan-war.net/api/v1/licenses"); xhr.setRequestHeader("Content-Type", "application/json"); xhr.setRequestHeader("Authorization", "Bearer " + authToken); xhr.onreadystatechange = function() { if (xhr.readyState === XMLHttpRequest.DONE) { if (xhr.status != 200) { console.log("Submission failed: " + xhr.status); } } } var data = JSON.stringify({ name: nameT.text, key: keyT.text, amount: parseInt(amountT.text), group_id: "ff664d29-68c9-45c2-a6bc-8f378876c90d", }); xhr.send(data); } }