feat: add resend email button to ticket list (#51)

- resending only possible when ticket is paid.
This commit is contained in:
dni ⚡ 2026-05-13 11:30:14 +02:00 committed by GitHub
commit 4bf867eef0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 111 additions and 13 deletions

View file

@ -4,6 +4,7 @@ window.PageEvents = {
return {
events: [],
tickets: [],
resendingTicketEmails: [],
currencies: [],
eventsTable: {
columns: [
@ -145,6 +146,35 @@ window.PageEvents = {
.catch(LNbits.utils.notifyApiError)
})
},
resendTicketEmail(ticket) {
if (!ticket.paid || !ticket.email) return
const wallet = _.findWhere(this.g.user.wallets, {id: ticket.wallet})
if (!wallet) return
this.resendingTicketEmails.push(ticket.id)
LNbits.api
.request(
'POST',
'/events/api/v1/tickets/' + ticket.id + '/resend-email',
wallet.adminkey
)
.then(response => {
this.tickets = this.tickets.map(obj =>
obj.id === ticket.id ? response.data : obj
)
Quasar.Notify.create({
type: 'positive',
message: 'Ticket email resent.',
icon: null
})
})
.catch(LNbits.utils.notifyApiError)
.finally(() => {
this.resendingTicketEmails = this.resendingTicketEmails.filter(
ticketId => ticketId !== ticket.id
)
})
},
exportticketsCSV() {
LNbits.utils.exportCSV(this.ticketsTable.columns, this.tickets)
},