Files
lnbits/lnbits/static/js/components/lnbits-wallet-api-docs.js
T

48 lines
1.3 KiB
JavaScript

window.app.component('lnbits-wallet-api-docs', {
template: '#lnbits-wallet-api-docs',
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 {
origin: window.location.origin,
inkeyHidden: true,
adminkeyHidden: true,
walletIdHidden: true
}
}
})