feat: Enhance authentication and user management with detailed logging

- Add console logging for authentication initialization, login attempts, and user retrieval to improve debugging and traceability.
- Introduce a new getCurrentUser function in useAuth for better user data management.
- Update useTicketPurchase to include detailed logging for user wallets and balance checks, enhancing visibility into wallet states.
- Refactor LNBits API request and response logging for clearer error handling and debugging.
This commit is contained in:
padreug 2025-08-01 23:08:20 +02:00
parent 217ca70334
commit 0cc0bf3555
4 changed files with 75 additions and 44 deletions

View file

@ -30,10 +30,25 @@ export function useTicketPurchase() {
}
})
const userWallets = computed(() => currentUser.value?.wallets || [])
const hasWalletWithBalance = computed(() =>
userWallets.value.some((wallet: any) => wallet.balance_msat > 0)
)
const userWallets = computed(() => {
const wallets = currentUser.value?.wallets || []
console.log('User wallets computed:', {
currentUser: currentUser.value,
wallets: wallets,
walletCount: wallets.length,
hasWallets: wallets.length > 0
})
return wallets
})
const hasWalletWithBalance = computed(() => {
const hasBalance = userWallets.value.some((wallet: any) => wallet.balance_msat > 0)
console.log('Wallet balance check:', {
wallets: userWallets.value,
hasBalance: hasBalance,
walletBalances: userWallets.value.map((w: any) => ({ id: w.id, balance: w.balance_msat }))
})
return hasBalance
})
// Generate QR code for Lightning payment
async function generateQRCode(bolt11: string) {