refactor: Clean up imports and unused variables in ticket-related components

- Remove unused imports from PurchaseTicketDialog.vue and useUserTickets.ts for improved code clarity.
- Update events.ts to eliminate the unused paymentRequest parameter in payInvoiceWithWallet function.
- Simplify MyTickets.vue by removing the unused unregisteredTickets variable and related QR code generation logic, enhancing maintainability.
This commit is contained in:
padreug 2025-08-01 22:30:38 +02:00
parent deabf9464a
commit 217ca70334
4 changed files with 8 additions and 15 deletions

View file

@ -1,6 +1,6 @@
<!-- eslint-disable vue/multi-word-component-names --> <!-- eslint-disable vue/multi-word-component-names -->
<script setup lang="ts"> <script setup lang="ts">
import { ref, onUnmounted } from 'vue' import { onUnmounted } from 'vue'
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '@/components/ui/dialog' import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '@/components/ui/dialog'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
import { Badge } from '@/components/ui/badge' import { Badge } from '@/components/ui/badge'
@ -30,7 +30,7 @@ const {
isLoading, isLoading,
error, error,
paymentHash, paymentHash,
paymentRequest,
qrCode, qrCode,
isPaymentPending, isPaymentPending,
isPayingWithWallet, isPayingWithWallet,

View file

@ -1,4 +1,4 @@
import { ref, computed } from 'vue' import { computed } from 'vue'
import { useAsyncState } from '@vueuse/core' import { useAsyncState } from '@vueuse/core'
import type { Ticket } from '@/lib/types/event' import type { Ticket } from '@/lib/types/event'
import { fetchUserTickets } from '@/lib/api/events' import { fetchUserTickets } from '@/lib/api/events'

View file

@ -1,4 +1,4 @@
import type { Event, EventsApiError, Ticket } from '../types/event' import type { Event, Ticket } from '../types/event'
import { config } from '@/lib/config' import { config } from '@/lib/config'
import { lnbitsAPI } from './lnbits' import { lnbitsAPI } from './lnbits'
@ -72,7 +72,7 @@ export async function purchaseTicket(eventId: string): Promise<{ payment_hash: s
} }
} }
export async function payInvoiceWithWallet(paymentRequest: string, walletId: string, adminKey: string): Promise<{ payment_hash: string; fee_msat: number; preimage: string }> { export async function payInvoiceWithWallet(paymentRequest: string, _walletId: string, adminKey: string): Promise<{ payment_hash: string; fee_msat: number; preimage: string }> {
try { try {
const response = await fetch( const response = await fetch(
`${API_BASE_URL}/api/v1/payments`, `${API_BASE_URL}/api/v1/payments`,

View file

@ -9,7 +9,7 @@ import { ScrollArea } from '@/components/ui/scroll-area'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
import { Badge } from '@/components/ui/badge' import { Badge } from '@/components/ui/badge'
import { format } from 'date-fns' import { format } from 'date-fns'
import { Ticket, User, Calendar, CreditCard, CheckCircle, Clock, AlertCircle, QrCode, ChevronLeft, ChevronRight } from 'lucide-vue-next' import { Ticket, User, CreditCard, CheckCircle, Clock, AlertCircle, ChevronLeft, ChevronRight } from 'lucide-vue-next'
const { isAuthenticated, userDisplay } = useAuth() const { isAuthenticated, userDisplay } = useAuth()
const { const {
@ -17,7 +17,7 @@ const {
paidTickets, paidTickets,
pendingTickets, pendingTickets,
registeredTickets, registeredTickets,
unregisteredTickets,
groupedTickets, groupedTickets,
isLoading, isLoading,
error, error,
@ -66,14 +66,7 @@ async function generateQRCode(ticketId: string) {
} }
} }
// Generate QR codes for all tickets in a group
async function generateAllQRCodes(tickets: any[]) {
for (const ticket of tickets) {
if (!qrCodes.value[ticket.id]) {
await generateQRCode(ticket.id)
}
}
}
// Ticket cycling functions // Ticket cycling functions
function getCurrentTicketIndex(eventId: string) { function getCurrentTicketIndex(eventId: string) {