chore: code clean-up

This commit is contained in:
Vlad Stan 2023-07-19 14:50:21 +03:00
parent e1fd62400d
commit 8ebe2fe458
4 changed files with 5 additions and 63 deletions

View file

@ -4,17 +4,7 @@ async function customerMarket(path) {
name: 'customer-market',
template,
props: [
'filtered-products',
'change-page',
'search-nostr',
'relays',
'update-products',
'update-stalls',
'search-text',
'filter-categories'
],
props: ['filtered-products', 'search-text', 'filter-categories'],
data: function () {
return {
search: null,
@ -54,33 +44,7 @@ async function customerMarket(path) {
changePageM(page, opts) {
this.$emit('change-page', page, opts)
},
async searchProducts() {
this.$q.loading.show()
let searchTags = this.search.split(' ')
const pool = new NostrTools.SimplePool()
let relays = Array.from(this.relays)
let merchants = new Set()
let productEvents = await pool.list(relays, [
{
kinds: [30018],
'#t': searchTags,
search: this.search, // NIP50, not very well supported
limit: 100
}
])
productEvents.map(e => merchants.add(e.pubkey))
let stallEvents = await pool.list(relays, [
{
kinds: [30017],
authors: Array.from(merchants)
}
])
pool.close(relays)
await this.$emit('update-data', [...stallEvents, ...productEvents])
this.$q.loading.hide()
},
onLoad(_, done) {
setTimeout(() => {
if (this.startIndex >= this.filteredProducts.length) {