diff --git a/src/composables/useAuth.ts b/src/composables/useAuth.ts index be80af2..7d7058d 100644 --- a/src/composables/useAuth.ts +++ b/src/composables/useAuth.ts @@ -13,23 +13,14 @@ export function useAuth() { */ async function initialize(): Promise { try { - console.log('Initializing authentication...') isLoading.value = true error.value = null - const isAuth = lnbitsAPI.isAuthenticated() - console.log('Is authenticated:', isAuth) - - if (isAuth) { - console.log('Getting current user...') + if (lnbitsAPI.isAuthenticated()) { const user = await lnbitsAPI.getCurrentUser() - console.log('Current user set:', user) currentUser.value = user - } else { - console.log('Not authenticated, skipping user fetch') } } catch (err) { - console.error('Authentication initialization error:', err) error.value = err instanceof Error ? err.message : 'Failed to initialize authentication' // Clear invalid token await logout() @@ -43,19 +34,15 @@ export function useAuth() { */ async function login(credentials: LoginCredentials): Promise { try { - console.log('Login attempt with credentials:', { username: credentials.username }) isLoading.value = true error.value = null await lnbitsAPI.login(credentials) - console.log('Login successful, getting user details...') // Get user details const user = await lnbitsAPI.getCurrentUser() - console.log('User details after login:', user) currentUser.value = user } catch (err) { - console.error('Login error:', err) error.value = err instanceof Error ? err.message : 'Login failed' throw err } finally { diff --git a/src/composables/useTicketPurchase.ts b/src/composables/useTicketPurchase.ts index 357b11f..e6bd52d 100644 --- a/src/composables/useTicketPurchase.ts +++ b/src/composables/useTicketPurchase.ts @@ -30,25 +30,10 @@ export function useTicketPurchase() { } }) - 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 - }) + const userWallets = computed(() => currentUser.value?.wallets || []) + const hasWalletWithBalance = computed(() => + userWallets.value.some((wallet: any) => wallet.balance_msat > 0) + ) // Generate QR code for Lightning payment async function generateQRCode(bolt11: string) { diff --git a/src/lib/api/lnbits.ts b/src/lib/api/lnbits.ts index 4b37e11..a6f0607 100644 --- a/src/lib/api/lnbits.ts +++ b/src/lib/api/lnbits.ts @@ -84,27 +84,11 @@ class LnbitsAPI { (headers as Record)['Authorization'] = `Bearer ${this.accessToken}` } - // Debug logging - console.log('LNBits API Request:', { - url, - method: options.method || 'GET', - headers: headers, - hasAccessToken: !!this.accessToken, - endpoint - }) - const response = await fetch(url, { ...options, headers, }) - console.log('LNBits API Response:', { - status: response.status, - statusText: response.statusText, - ok: response.ok, - url: response.url - }) - if (!response.ok) { const errorText = await response.text() console.error('LNBits API Error:', { @@ -116,7 +100,6 @@ class LnbitsAPI { } const data = await response.json() - console.log('LNBits API Response Data:', data) return data } @@ -151,10 +134,7 @@ class LnbitsAPI { } async getCurrentUser(): Promise { - console.log('getCurrentUser called, accessToken:', this.accessToken ? 'present' : 'missing') - const user = await this.request('/auth') - console.log('getCurrentUser response:', user) - return user + return this.request('/auth') } async updatePassword(currentPassword: string, newPassword: string): Promise {