refactor: move logout to utils (#3509)

This commit is contained in:
dni ⚡ 2025-11-12 10:14:27 +01:00 committed by GitHub
parent 783efb19db
commit 1e6e97c12d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 17 deletions

File diff suppressed because one or more lines are too long

View file

@ -12,6 +12,21 @@ window._lnbitsUtils = {
}
})
},
async logout() {
LNbits.utils
.confirmDialog(
'Do you really want to logout?' +
' Please visit "My Account" page to check your credentials!'
)
.onOk(async () => {
try {
await LNbits.api.logout()
window.location = '/'
} catch (e) {
LNbits.utils.notifyApiError(e)
}
})
},
async digestMessage(message) {
const msgUint8 = new TextEncoder().encode(message)
const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8)

View file

@ -2,6 +2,8 @@ window.windowMixin = {
i18n: window.i18n,
data() {
return {
api: window._lnbitsApi,
utils: window._lnbitsUtils,
g: window.g,
toggleSubs: true,
mobileSimple: true,
@ -213,21 +215,6 @@ window.windowMixin = {
)
}
},
async logout() {
LNbits.utils
.confirmDialog(
'Do you really want to logout?' +
' Please visit "My Account" page to check your credentials!'
)
.onOk(async () => {
try {
await LNbits.api.logout()
window.location = '/'
} catch (e) {
LNbits.utils.notifyApiError(e)
}
})
},
themeParams() {
const url = new URL(window.location.href)
const params = new URLSearchParams(window.location.search)

View file

@ -115,7 +115,7 @@
</q-item-section>
</q-item>
<q-separator></q-separator>
<q-item clickable v-close-popup @click="logout"
<q-item clickable v-close-popup @click="utils.logout"
><q-item-section>
<q-icon name="logout" />
</q-item-section>