general fixes, prop passing and shopping cart (doesn't send dm)

This commit is contained in:
Tiago Vasconcelos 2023-03-04 19:49:58 +00:00
parent f71b9f56d9
commit 52f8dead0e
11 changed files with 355 additions and 96 deletions

View file

@ -145,6 +145,7 @@
:products="filterProducts"
:exchange-rates="exchangeRates"
:product-detail="activeProduct"
:relays="relays"
@change-page="navigateTo"
></customer-stall>
<customer-market

View file

@ -1,61 +0,0 @@
{% extends "public.html" %} {% block page %}
<div class="row q-mb-md"></div>
{% endblock %} {% block scripts %}
<script src="https://unpkg.com/nostr-tools/lib/nostr.bundle.js"></script>
<script>
const nostr = window.NostrTools
const defaultRelays = [
'wss://relay.damus.io',
'wss://relay.snort.social',
'wss://nos.lol',
'wss://nostr.wine',
'wss://relay.nostr.bg',
'wss://nostr-pub.wellorder.net',
'wss://nostr-pub.semisol.dev',
'wss://eden.nostr.land',
'wss://nostr.mom',
'wss://nostr.fmt.wiz.biz',
'wss://nostr.zebedee.cloud'
]
const mapProductsItems = obj => {
obj.price = parseFloat((obj.price / 100).toFixed(2))
return obj
}
Vue.component(VueQrcode.name, VueQrcode)
new Vue({
el: '#vue',
mixins: [windowMixin],
data: function () {
return {}
},
async created() {
this.stallId = JSON.parse('{{ stall_id }}')
await initNostr()
//this.products = JSON.parse('{{ products | tojson }}')
//this.unit = this.stall.currency
/*if (this.unit != 'sat') {
this.products = this.products.map(mapProductsItems)
}
await this.getRates()
setInterval(this.getRates, 300000)*/
},
methods: {
async initNostr() {
this.pool = new nostr.SimplePool()
this.relays = new Set(defaultRelays)
await this.pool
.get(Array.from(this.relays), {
kinds: [30023],
limit: 1,
'#d': [this.stallId]
})
.then(event => {
console.log(event)
})
}
}
})
</script>
{% endblock %}