refactor: move logout to utils (#3509)
This commit is contained in:
parent
783efb19db
commit
1e6e97c12d
4 changed files with 19 additions and 17 deletions
2
lnbits/static/bundle.min.js
vendored
2
lnbits/static/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -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,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)
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue