fix(events): read buyer id from auth service in fiat checkout

The fiat path pulled `currentUser` off the LNbits API client, which
never exposed it — only `getAccessToken()`. `userId` was therefore
always undefined and every Stripe/fiat "Continue" click failed with
"Missing user id" before the request was ever sent.

Use `useAuth()`'s `currentUser`, the same source the Lightning path
already goes through.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YLt6zWfXA1hM8zYQdpbeyn
This commit is contained in:
Padreug 2026-09-05 19:51:04 +02:00
commit 0c5b577499

View file

@ -36,7 +36,7 @@ interface Emits {
const props = defineProps<Props>() const props = defineProps<Props>()
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
const { isAuthenticated, userDisplay } = useAuth() const { isAuthenticated, userDisplay, currentUser } = useAuth()
const { const {
isLoading, isLoading,
error, error,
@ -201,8 +201,7 @@ async function handlePurchase() {
const lnbitsAPI = injectService(SERVICE_TOKENS.LNBITS_API) as any const lnbitsAPI = injectService(SERVICE_TOKENS.LNBITS_API) as any
const accessToken = lnbitsAPI?.getAccessToken?.() || '' const accessToken = lnbitsAPI?.getAccessToken?.() || ''
const ticketApi = injectService(SERVICE_TOKENS.TICKET_API) as TicketApiService const ticketApi = injectService(SERVICE_TOKENS.TICKET_API) as TicketApiService
const currentUser = (lnbitsAPI?.currentUser?.value) || null const userId = currentUser.value?.id
const userId = currentUser?.id
if (!userId) { if (!userId) {
fiatError.value = 'Missing user id' fiatError.value = 'Missing user id'
return return