File size: 744 Bytes
47fc8e1 5a7302b 47fc8e1 7d72a03 9853b20 5a7302b 47fc8e1 5a7302b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import { createClient } from '@supabase/supabase-js'
import type { SupabaseClient } from '@supabase/supabase-js'
import type { Database } from 'types/database'
import { getSupabaseBrowserAnonKey, getSupabaseBrowserUrl, isSupabaseBrowserConfigured } from './publicEnv'
type BrowserSupabaseClient = SupabaseClient<Database, 'public', any>
// Minimal browser Supabase client for places, that still expect it.
// Returns null when public env vars are not available (e.g., offline/demo mode).
export const createBrowserClient = (): BrowserSupabaseClient | null => {
if (!isSupabaseBrowserConfigured()) return null
return createClient<Database>(getSupabaseBrowserUrl(), getSupabaseBrowserAnonKey(), {
auth: { persistSession: false }
})
}
|