refactor: move walletTypes from mixin into lnbits-new-user-wallet (#3519)

This commit is contained in:
dni ⚡
2025-11-13 13:29:43 +01:00
committed by GitHub
parent 00eaec8290
commit f1fc4710ee
5 changed files with 21 additions and 20 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -4,6 +4,7 @@ window.app.component('lnbits-new-user-wallet', {
mixins: [window.windowMixin],
data() {
return {
walletTypes: [{label: 'Lightning Wallet', value: 'lightning'}],
newWallet: {walletType: 'lightning', name: '', sharedWalletId: ''}
}
},
@@ -70,5 +71,13 @@ window.app.component('lnbits-new-user-wallet', {
LNbits.utils.notifyApiError(e)
}
}
},
created() {
if (this.g.user?.extra?.wallet_invite_requests?.length) {
this.walletTypes.push({
label: `Lightning Wallet (Share Invite: ${this.g.user.extra.wallet_invite_requests.length})`,
value: 'lightning-shared'
})
}
}
})
+10
View File
@@ -50,3 +50,13 @@ const websocketPrefix =
const websocketUrl = `${websocketPrefix}${window.location.host}/api/v1/ws`
const _access_cookies_for_safari_refresh_do_not_delete = document.cookie
addEventListener('offline', event => {
console.log('offline', event)
this.g.offline = true
})
addEventListener('online', event => {
console.log('back online', event)
this.g.offline = false
})
-18
View File
@@ -7,7 +7,6 @@ window.windowMixin = {
g: window.g,
toggleSubs: true,
addWalletDialog: {show: false, walletType: 'lightning'},
walletTypes: [{label: 'Lightning Wallet', value: 'lightning'}],
isSatsDenomination: WINDOW_SETTINGS['LNBITS_DENOMINATION'] == 'sats',
allowedThemes: WINDOW_SETTINGS['LNBITS_THEME_OPTIONS'],
walletEventListeners: [],
@@ -125,26 +124,9 @@ window.windowMixin = {
}
},
async created() {
addEventListener('offline', event => {
console.log('offline', event)
this.g.offline = true
})
addEventListener('online', event => {
console.log('back online', event)
this.g.offline = false
})
if (window.user) {
this.g.user = Vue.reactive(window.LNbits.map.user(window.user))
}
if (this.g.user?.extra?.wallet_invite_requests?.length) {
this.walletTypes.push({
label: `Lightning Wallet (Share Invite: ${this.g.user.extra.wallet_invite_requests.length})`,
value: 'lightning-shared'
})
}
if (window.wallet) {
this.g.wallet = Vue.reactive(window.LNbits.map.wallet(window.wallet))
}