native: fix logout button

This commit is contained in:
Johannes Jöns 2024-07-11 11:25:08 +02:00
parent dabf39fa9a
commit 0b76f3472d
2 changed files with 8 additions and 7 deletions

View file

@ -42,6 +42,9 @@ Window {
id: mainPageComponent id: mainPageComponent
MainPage { MainPage {
authToken: authToken authToken: authToken
onLogout: {
stackView.push(loginPageComponent)
}
} }
} }
} }

View file

@ -14,6 +14,8 @@ Rectangle {
property string authToken: "" property string authToken: ""
signal logout()
Rectangle { Rectangle {
id: s1 id: s1
anchors { anchors {
@ -43,12 +45,10 @@ Rectangle {
rightMargin: 10 rightMargin: 10
right: s1.right right: s1.right
} }
text: qsTr("Login") text: qsTr("Logout")
onClicked: { onClicked: {
var component = Qt.createComponent("LoginScreen.qml") logout();
var window = component.createObject(root)
window.show()
} }
} }
} }
@ -122,9 +122,7 @@ Rectangle {
} }
text: qsTr("Login Screen") text: qsTr("Login Screen")
onClicked: { onClicked: {
var component = Qt.createComponent("LoginScreen.qml") logout();
var window = component.createObject(root)
window.show()
} }
} }
} }