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 visible: true color: getColors().window title: qsTr("Alisa - Add License Group") 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: submit() } Button { id: submitB anchors { horizontalCenter: parent.horizontalCenter topMargin: 5 top: nameT.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/groups"); 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, }); xhr.send(data); dataScreen.close() } }