native: fix login button

fixes #20
This commit is contained in:
jopejoe1 2024-07-11 11:41:24 +02:00
parent ffae1c2ed7
commit a6118791b1
2 changed files with 22 additions and 20 deletions

View file

@ -71,7 +71,10 @@ Rectangle {
text: qsTr("Submit")
onClicked: {
onClicked: login
}
function login() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "https://api.clan-war.net/api/v1/auth/login");
xhr.setRequestHeader("Content-Type", "application/json");
@ -92,4 +95,3 @@ Rectangle {
xhr.send(data);
}
}
}

View file

@ -31,9 +31,9 @@ Window {
Component {
id: loginPageComponent
LoginScreen {
onLoginSuccess: {
authToken = token
stackView.push(mainPageComponent)
onLoginSuccess: function(token) {
authToken = token;
stackView.push(mainPageComponent);
}
}
}