Merge pull request #21 from lnbits/final_fixes

Final fixes
This commit is contained in:
Vlad Stan 2023-03-17 11:23:09 +02:00 committed by GitHub
commit f91c0ec38c

View file

@ -193,11 +193,6 @@ async function customerStall(path) {
},
async placeOrder() {
this.loading = true
LNbits.utils
.confirmDialog(
`Send the order to the merchant? You should receive a message with the payment details.`
)
.onOk(async () => {
let orderData = this.checkoutDialog.data
let orderObj = {
name: orderData?.username,
@ -214,9 +209,7 @@ async function customerStall(path) {
}
let created_at = Math.floor(Date.now() / 1000)
orderObj.id = await hash(
[this.customerPubkey, created_at, JSON.stringify(orderObj)].join(
':'
)
[this.customerPubkey, created_at, JSON.stringify(orderObj)].join(':')
)
this.activeOrder = orderObj.id
let event = {
@ -246,16 +239,12 @@ async function customerStall(path) {
}
event.id = NostrTools.getEventHash(event)
if (this.customerPrivkey) {
event.sig = await NostrTools.signEvent(
event,
this.customerPrivkey
)
event.sig = await NostrTools.signEvent(event, this.customerPrivkey)
} else if (this.customerUseExtension && this.hasNip07) {
event = await window.nostr.signEvent(event)
}
this.resetCheckout()
await this.sendOrder(event)
})
},
async sendOrder(order) {
this.$q.notify({
@ -276,7 +265,7 @@ async function customerStall(path) {
await relay.connect()
let pub = relay.publish(order)
pub.on('ok', () => {
console.debug(`${relay.url} has accepted our event`)
console.debug(`${relay.url} has accepted our event: ${order.id}`)
relay.close()
})
pub.on('failed', reason => {