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
4 changed files with 19 additions and 17 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+15
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)
+2 -15
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)