This commit is contained in:
Marcelo
2026-02-17 00:07:00 +00:00
parent b7a86a2d1c
commit be4ca2ed78
92 changed files with 6850 additions and 1188 deletions

9
lib/supabase/browser.ts Normal file → Executable file
View File

@@ -1,17 +1,16 @@
import { createClient, type SupabaseClient } from "@supabase/supabase-js";
import { readSupabasePublicConfig } from "@/lib/supabase/config";
let browserClient: SupabaseClient | null = null;
export const supabaseBrowser = (): SupabaseClient | null => {
const url = process.env.NEXT_PUBLIC_SUPABASE_URL;
const anonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
if (!url || !anonKey) {
const config = readSupabasePublicConfig();
if (!config) {
return null;
}
if (!browserClient) {
browserClient = createClient(url, anonKey);
browserClient = createClient(config.url, config.anonKey);
}
return browserClient;