refactor: move _api_docs.html into vue component (#3520)
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -21,28 +21,6 @@ window.app.component('lnbits-fsat', {
|
||||
}
|
||||
})
|
||||
|
||||
window.app.component('lnbits-wallet-list', {
|
||||
mixins: [window.windowMixin],
|
||||
template: '#lnbits-wallet-list',
|
||||
props: ['balance'],
|
||||
data() {
|
||||
return {
|
||||
activeWallet: null,
|
||||
balance: 0,
|
||||
walletName: '',
|
||||
LNBITS_DENOMINATION: LNBITS_DENOMINATION
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
createWallet() {
|
||||
this.$emit('wallet-action', {action: 'create-wallet'})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
document.addEventListener('updateWalletBalance', this.updateWalletBalance)
|
||||
}
|
||||
})
|
||||
|
||||
window.app.component('lnbits-manage', {
|
||||
mixins: [window.windowMixin],
|
||||
template: '#lnbits-manage',
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
window.app.component('lnbits-wallet-api-docs', {
|
||||
template: '#lnbits-wallet-api-docs',
|
||||
mixins: [window.windowMixin],
|
||||
methods: {
|
||||
resetKeys() {
|
||||
LNbits.utils
|
||||
.confirmDialog('Are you sure you want to reset your API keys?')
|
||||
.onOk(() => {
|
||||
LNbits.api
|
||||
.resetWalletKeys(this.g.wallet)
|
||||
.then(response => {
|
||||
const {id, adminkey, inkey} = response
|
||||
this.g.wallet = {
|
||||
...this.g.wallet,
|
||||
inkey,
|
||||
adminkey
|
||||
}
|
||||
const walletIndex = this.g.user.wallets.findIndex(
|
||||
wallet => wallet.id === id
|
||||
)
|
||||
if (walletIndex !== -1) {
|
||||
this.g.user.wallets[walletIndex] = {
|
||||
...this.g.user.wallets[walletIndex],
|
||||
inkey,
|
||||
adminkey
|
||||
}
|
||||
}
|
||||
Quasar.Notify.create({
|
||||
timeout: 3500,
|
||||
type: 'positive',
|
||||
message: 'API keys reset!'
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
LNbits.utils.notifyApiError(err)
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
inkeyHidden: true,
|
||||
adminkeyHidden: true,
|
||||
walletIdHidden: true
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,21 @@
|
||||
window.app.component('lnbits-wallet-list', {
|
||||
template: '#lnbits-wallet-list',
|
||||
mixins: [window.windowMixin],
|
||||
props: ['balance'],
|
||||
data() {
|
||||
return {
|
||||
activeWallet: null,
|
||||
balance: 0,
|
||||
walletName: '',
|
||||
LNBITS_DENOMINATION: LNBITS_DENOMINATION
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
createWallet() {
|
||||
this.$emit('wallet-action', {action: 'create-wallet'})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
document.addEventListener('updateWalletBalance', this.updateWalletBalance)
|
||||
}
|
||||
})
|
||||
@@ -641,40 +641,6 @@ window.WalletPageLogic = {
|
||||
}
|
||||
})
|
||||
},
|
||||
resetKeys() {
|
||||
LNbits.utils
|
||||
.confirmDialog('Are you sure you want to reset your API keys?')
|
||||
.onOk(() => {
|
||||
LNbits.api
|
||||
.resetWalletKeys(this.g.wallet)
|
||||
.then(response => {
|
||||
const {id, adminkey, inkey} = response
|
||||
this.g.wallet = {
|
||||
...this.g.wallet,
|
||||
inkey,
|
||||
adminkey
|
||||
}
|
||||
const walletIndex = this.g.user.wallets.findIndex(
|
||||
wallet => wallet.id === id
|
||||
)
|
||||
if (walletIndex !== -1) {
|
||||
this.g.user.wallets[walletIndex] = {
|
||||
...this.g.user.wallets[walletIndex],
|
||||
inkey,
|
||||
adminkey
|
||||
}
|
||||
}
|
||||
Quasar.Notify.create({
|
||||
timeout: 3500,
|
||||
type: 'positive',
|
||||
message: 'API keys reset!'
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
LNbits.utils.notifyApiError(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
updateWallet(data) {
|
||||
LNbits.api
|
||||
.request('PATCH', '/api/v1/wallet', this.g.wallet.adminkey, data)
|
||||
|
||||
@@ -67,6 +67,8 @@
|
||||
"js/components/admin/lnbits-admin-site-customisation.js",
|
||||
"js/components/admin/lnbits-admin-assets-config.js",
|
||||
"js/components/admin/lnbits-admin-audit.js",
|
||||
"js/components/lnbits-wallet-list.js",
|
||||
"js/components/lnbits-wallet-api-docs.js",
|
||||
"js/components/lnbits-home-logos.js",
|
||||
"js/components/lnbits-new-user-wallet.js",
|
||||
"js/components/lnbits-qrcode.js",
|
||||
|
||||
Reference in New Issue
Block a user