AgentIC / web /src /supabaseClient.ts
vxkyyy's picture
fix: local dev white screen when Supabase missing
e1af51b
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);