diff --git a/src/lib/api/lnbits.ts b/src/lib/api/lnbits.ts index a6f0607..4198345 100644 --- a/src/lib/api/lnbits.ts +++ b/src/lib/api/lnbits.ts @@ -75,6 +75,8 @@ class LnbitsAPI { options: RequestInit = {} ): Promise { const url = getApiUrl(endpoint) + console.log('🔧 LNBits API request:', { endpoint, fullUrl: url }) + const headers: HeadersInit = { 'Content-Type': 'application/json', ...options.headers, diff --git a/src/lib/config/index.ts b/src/lib/config/index.ts index aeea484..40ae1d3 100644 --- a/src/lib/config/index.ts +++ b/src/lib/config/index.ts @@ -77,6 +77,13 @@ export const config: AppConfig = { } } as const +// Debug logging +console.log('🔧 Config loaded:', { + VITE_LNBITS_BASE_URL: import.meta.env.VITE_LNBITS_BASE_URL, + apiBaseUrl: config.api.baseUrl, + apiKey: config.api.key ? '***' : 'not set' +}) + // Utility functions for common config operations export const configUtils = { isAdminPubkey: (pubkey: string): boolean => { diff --git a/src/lib/config/lnbits.ts b/src/lib/config/lnbits.ts index b267a5f..5d6ce0c 100644 --- a/src/lib/config/lnbits.ts +++ b/src/lib/config/lnbits.ts @@ -3,20 +3,27 @@ export const LNBITS_CONFIG = { // Base URL for the LNBits API // This should point to your LNBits instance API_BASE_URL: `${import.meta.env.VITE_LNBITS_BASE_URL || ''}/api/v1`, - + // Whether to enable debug logging DEBUG: import.meta.env.VITE_LNBITS_DEBUG === 'true', - + // Timeout for API requests (in milliseconds) REQUEST_TIMEOUT: 10000, - + // Auth token storage key AUTH_TOKEN_KEY: 'lnbits_access_token', - + // User storage key USER_STORAGE_KEY: 'lnbits_user_data' } +// Debug logging +console.log('🔧 LNBits Config loaded:', { + VITE_LNBITS_BASE_URL: import.meta.env.VITE_LNBITS_BASE_URL, + API_BASE_URL: LNBITS_CONFIG.API_BASE_URL, + DEBUG: LNBITS_CONFIG.DEBUG +}) + // Helper function to get the full API URL export function getApiUrl(endpoint: string): string { return `${LNBITS_CONFIG.API_BASE_URL}${endpoint}` @@ -35,4 +42,4 @@ export function setAuthToken(token: string): void { // Helper function to remove auth token from storage export function removeAuthToken(): void { localStorage.removeItem(LNBITS_CONFIG.AUTH_TOKEN_KEY) -} \ No newline at end of file +}