push before removing uuid

This commit is contained in:
ben 2022-08-24 09:33:38 +01:00
parent c10f89e1d6
commit 59d6b654c5
3 changed files with 44 additions and 4 deletions

View file

@ -17,6 +17,7 @@ new Vue({
toggleAdvanced: false, toggleAdvanced: false,
cards: [], cards: [],
hits: [], hits: [],
refunds: [],
cardDialog: { cardDialog: {
show: false, show: false,
data: { data: {
@ -164,6 +165,23 @@ new Vue({
console.log(self.hits) console.log(self.hits)
}) })
}, },
getRefunds: function () {
var self = this
LNbits.api
.request(
'GET',
'/boltcards/api/v1/refunds?all_wallets=true',
this.g.user.wallets[0].inkey
)
.then(function (response) {
self.refunds = response.data.map(function (obj) {
obj.card_name = self.cards.find(d => d.id == obj.card_id).card_name
return mapCards(obj)
})
console.log(self.hits)
})
},
openQrCodeDialog(cardId) { openQrCodeDialog(cardId) {
var card = _.findWhere(this.cards, {id: cardId}) var card = _.findWhere(this.cards, {id: cardId})
@ -177,8 +195,13 @@ new Vue({
} }
this.qrCodeDialog.show = true this.qrCodeDialog.show = true
}, },
generateKeys: function () { addCardOpen: function () {
this.cardDialog.show = true this.cardDialog.show = true
var elem = this.$els.myBtn
elem.click()
},
generateKeys: function () {
const genRanHex = size => const genRanHex = size =>
[...Array(size)] [...Array(size)]
.map(() => Math.floor(Math.random() * 16).toString(16)) .map(() => Math.floor(Math.random() * 16).toString(16))
@ -307,7 +330,7 @@ new Vue({
if (this.g.user.wallets.length) { if (this.g.user.wallets.length) {
this.getCards() this.getCards()
this.getHits() this.getHits()
this.getWithdraws() this.getRefunds()
} }
} }
}) })

View file

@ -5,7 +5,7 @@
<div class="col-12 col-md-8 col-lg-7 q-gutter-y-md"> <div class="col-12 col-md-8 col-lg-7 q-gutter-y-md">
<q-card> <q-card>
<q-card-section> <q-card-section>
<q-btn unelevated color="primary" v-on:click="generateKeys" <q-btn unelevated color="primary" v-on:click="addCardOpen"
>Add Card</q-btn >Add Card</q-btn
> >
</q-card-section> </q-card-section>
@ -234,7 +234,7 @@
v-model="toggleAdvanced" v-model="toggleAdvanced"
label="Show advanced options" label="Show advanced options"
></q-toggle> ></q-toggle>
<div v-if="toggleAdvanced"> <div v-show="toggleAdvanced">
<q-input <q-input
filled filled
dense dense
@ -281,6 +281,7 @@
class="q-ml-auto" class="q-ml-auto"
v-on:click="generateKeys" v-on:click="generateKeys"
v-on:click.right="debugKeys" v-on:click.right="debugKeys"
v-el:keybtn
>Generate keys</q-btn >Generate keys</q-btn
> >
</div> </div>

View file

@ -110,6 +110,22 @@ async def api_hits(
): ):
wallet_ids = [g.wallet.id] wallet_ids = [g.wallet.id]
if all_wallets:
wallet_ids = (await get_user(g.wallet.user)).wallet_ids
cards = await get_cards(wallet_ids)
cards_ids = []
for card in cards:
cards_ids.append(card.id)
return [hit.dict() for hit in await get_hits(cards_ids)]
@boltcards_ext.get("/api/v1/refunds")
async def api_hits(
g: WalletTypeInfo = Depends(get_key_type), all_wallets: bool = Query(False)
):
wallet_ids = [g.wallet.id]
if all_wallets: if all_wallets:
wallet_ids = (await get_user(g.wallet.user)).wallet_ids wallet_ids = (await get_user(g.wallet.user)).wallet_ids