File size: 812 Bytes
1d4d3e9 e1af51b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import { createClient } from '@supabase/supabase-js';
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL || '';
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY || '';
// Create a dummy client if vars are missing so the app doesn't crash on import
// We guard actual usage of this with AUTH_ENABLED in App.tsx
export const supabase = supabaseUrl && supabaseAnonKey
? createClient(supabaseUrl, supabaseAnonKey)
: ({
auth: {
getSession: async () => ({ data: { session: null } }),
onAuthStateChange: () => ({ data: { subscription: { unsubscribe: () => {} } } }),
signInWithPassword: async () => ({ error: new Error('Auth disabled') }),
signUp: async () => ({ error: new Error('Auth disabled') }),
signOut: async () => {},
}
} as any);
|