From 33522204d6311cf59c7bc7c7b579189f83829e5e Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Mon, 10 Oct 2022 09:07:15 +0300 Subject: [PATCH] feat: store `tokenBuys` --- .../cashu/templates/cashu/wallet.html | 240 +++++++++--------- 1 file changed, 117 insertions(+), 123 deletions(-) diff --git a/lnbits/extensions/cashu/templates/cashu/wallet.html b/lnbits/extensions/cashu/templates/cashu/wallet.html index 3eb678616..6cf03b7d6 100644 --- a/lnbits/extensions/cashu/templates/cashu/wallet.html +++ b/lnbits/extensions/cashu/templates/cashu/wallet.html @@ -110,142 +110,129 @@ page_container %} :filter="buysTable.filter" > {% raw %} - {% endraw %} @@ -623,6 +610,7 @@ page_container %} mintId: '', mintName: '', + tokenBuys: [], buyTokens: { showDialog: false, amount: 0, @@ -713,9 +701,9 @@ page_container %} formattedBalance: function () { return this.balance / 100 }, - tokenBuys: function() { - return [] - }, + // tokenBuys: function() { + // return [] + // }, canPay: function () { if (!this.parse.invoice) return false @@ -973,8 +961,11 @@ page_container %} `/cashu/api/v1/cashu/${this.mintId}/mint?amount=${this.buyTokens.amount}` ) console.log('### data', data) + this.buyTokens.bolt11 = data.pr this.buyTokens.hash = data.hash + this.tokenBuys.push({...this.buyTokens, date: new Date().toISOString()}) + localStorage.setItem('cashu.tokenBuys', JSON.stringify(this.tokenBuys)) } catch (error) { LNbits.utils.notifyApiError(error) } @@ -1027,6 +1018,9 @@ page_container %} } else if (this.$q.localStorage.getItem('cashu.name')) { this.mintName = this.$q.localStorage.getItem('cashu.name') } + + this.tokenBuys = JSON.parse(localStorage.getItem('cashu.tokenBuys') || '[]') + console.log('#### this.tokenBuys', this.tokenBuys) console.log('#### this.mintId', this.mintId) console.log('#### this.mintName', this.mintName) }