Download src/lib/supabaseClient.ts from sitcod3/modul-e: direct link, hf CLI and curl.
- Browser
- Download file 952 Bytes
-
https://huggingface.co/spaces/sitcod3/modul-e/resolve/f3eb729df65e488ec2095e374a70f2a342c8b7ca/src/lib/supabaseClient.ts
- Command line
-
hf download hf://spaces/sitcod3/modul-e@f3eb729df65e488ec2095e374a70f2a342c8b7ca/src/lib/supabaseClient.ts
-
curl -L -o supabaseClient.ts https://huggingface.co/spaces/sitcod3/modul-e/resolve/f3eb729df65e488ec2095e374a70f2a342c8b7ca/src/lib/supabaseClient.ts
952 Bytes
| import { createClient } from '@supabase/supabase-js'; | |
| const supabaseUrl = import.meta.env.VITE_SUPABASE_URL; | |
| const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY; | |
| export const supabase = supabaseUrl && supabaseAnonKey | |
| ? createClient(supabaseUrl, supabaseAnonKey) | |
| : null; | |
| export const isSupabaseConfigured = () => { | |
| return !!supabase; | |
| }; | |
| /** Project ref derived from VITE_SUPABASE_URL (for status text + links). */ | |
| export const supabaseProjectRef = (): string => { | |
| const url = import.meta.env.VITE_SUPABASE_URL as string | undefined; | |
| const m = url?.match(/^https:\/\/([a-z0-9-]+)\.supabase\.co/i); | |
| return m ? m[1] : "unconfigured"; | |
| }; | |
| /** Deep link to the configured project (or the dashboard when unset). */ | |
| export const supabaseDashboardUrl = (): string => { | |
| const ref = supabaseProjectRef(); | |
| return ref === "unconfigured" | |
| ? "https://supabase.com/dashboard" | |
| : `https://supabase.com/dashboard/project/${ref}`; | |
| }; | |