diff options
Diffstat (limited to 'lib/supabase.ts')
| -rw-r--r-- | lib/supabase.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/supabase.ts b/lib/supabase.ts new file mode 100644 index 0000000..0c8b6a8 --- /dev/null +++ b/lib/supabase.ts @@ -0,0 +1,13 @@ +import { createClient } from "@supabase/supabase-js"; + +let supabaseClient: ReturnType<typeof createClient> | null = null; + +export const getSupabaseClient = () => { + if (supabaseClient) return supabaseClient; + + const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL || ""; + const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || ""; + + supabaseClient = createClient(supabaseUrl, supabaseKey); + return supabaseClient; +}; |