| import { createClient } from '@supabase/supabase-js'; | |
| // Utilise les constantes définies par Vite au lieu de import.meta.env | |
| // Ces constantes sont des chaînes littérales injectées lors du build | |
| const supabaseUrl = __VITE_SUPABASE_URL__; | |
| const supabaseAnonKey = __VITE_SUPABASE_ANON_KEY__; | |
| // Create Supabase client instance | |
| export const supabase = createClient( | |
| supabaseUrl, | |
| supabaseAnonKey, | |
| { | |
| auth: { | |
| autoRefreshToken: true, | |
| persistSession: true, | |
| detectSessionInUrl: true | |
| }, | |
| global: { | |
| headers: { | |
| 'X-Client-Info': 'lin-app/1.0' | |
| } | |
| } | |
| } | |
| ); | |
| // Listen for auth state changes | |
| const { data: authListener } = supabase.auth.onAuthStateChange((event, session) => { | |
| // Auth state changes are handled by the application logic | |
| }); | |
| export default supabase; |