refactor: stuff
This commit is contained in:
parent
f41a502d3b
commit
e1fd62400d
1 changed files with 9 additions and 10 deletions
|
|
@ -441,21 +441,20 @@ const market = async () => {
|
||||||
await this.updateData(events)
|
await this.updateData(events)
|
||||||
|
|
||||||
const lastEvent = events.sort((a, b) => b.created_at - a.created_at)[0]
|
const lastEvent = events.sort((a, b) => b.created_at - a.created_at)[0]
|
||||||
console.log('### since', lastEvent.created_at) // 1685456534, 1689758074
|
|
||||||
this.poolSubscribe(lastEvent.created_at)
|
this.poolSubscribe(lastEvent.created_at)
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
},
|
},
|
||||||
async poolSubscribe(since) {
|
async poolSubscribe(since) {
|
||||||
const authors = this.merchants.map(m => m.publicKey)
|
const authors = this.merchants.map(m => m.publicKey)
|
||||||
this.poolSub = this.pool.sub(Array.from(this.relays), [{ kinds: [0, 5, 30017, 30018], authors, since }])
|
this.pool
|
||||||
this.poolSub.on(
|
.sub(Array.from(this.relays), [{ kinds: [0, 5, 30017, 30018], authors, since }])
|
||||||
'event',
|
.on(
|
||||||
event => {
|
'event',
|
||||||
console.log('####### new event', event)
|
event => {
|
||||||
this.updateData([event])
|
this.updateData([event])
|
||||||
},
|
},
|
||||||
{ id: 'masterSub' } //pass ID to cancel previous sub
|
{ id: 'masterSub' } //pass ID to cancel previous sub
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
async checkMarketNaddr(naddr) {
|
async checkMarketNaddr(naddr) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue