feat: adds a wallet select to picking wallet + uv (#37)
* Adds a wallet select to picking wallet
* added uv
* uv uv uv
---------
Co-authored-by: dni ⚡ <office@dnilabs.com>
This commit is contained in:
parent
d963af4042
commit
81184a0a53
9 changed files with 2364 additions and 3699 deletions
|
|
@ -51,8 +51,11 @@ window.app = Vue.createApp({
|
|||
'/splitpayments/api/v1/targets',
|
||||
this.selectedWallet.adminkey
|
||||
)
|
||||
.then(response => {
|
||||
this.targets = response.data
|
||||
.then(res => {
|
||||
this.targets = res.data.map(t => ({
|
||||
...t,
|
||||
targetChoice: t.targetChoice || 'wallet'
|
||||
}))
|
||||
})
|
||||
.catch(err => {
|
||||
LNbits.utils.notifyApiError(err)
|
||||
|
|
@ -63,16 +66,26 @@ window.app = Vue.createApp({
|
|||
this.getTargets()
|
||||
},
|
||||
addTarget() {
|
||||
this.targets.push({source: this.selectedWallet})
|
||||
this.targets.push({
|
||||
source: this.selectedWallet,
|
||||
targetChoice: 'wallet'
|
||||
})
|
||||
},
|
||||
saveTargets() {
|
||||
const payload = this.targets
|
||||
.filter(t => t.wallet && String(t.wallet).trim() !== '')
|
||||
.map(({alias, percent, wallet}) => ({
|
||||
alias,
|
||||
percent: Number(percent) || 0,
|
||||
wallet
|
||||
}))
|
||||
LNbits.api
|
||||
.request(
|
||||
'PUT',
|
||||
'/splitpayments/api/v1/targets',
|
||||
this.selectedWallet.adminkey,
|
||||
{
|
||||
targets: this.targets
|
||||
targets: payload
|
||||
}
|
||||
)
|
||||
.then(response => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue