feat: Initialize CAR Auto Center project with Vite and React
Sets up the foundational structure for the CAR Auto Center application using Vite and React. Includes project dependencies, basic HTML structure, TypeScript configuration, and initial README content. This commit establishes the project's build tool, core libraries, and essential configuration files.
This commit is contained in:
18
lib/supabase.ts
Normal file
18
lib/supabase.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
// NOTA: Em produção, estas variáveis devem estar no .env
|
||||
// Para teste imediato, se as variáveis não existirem, o sistema usará localStorage
|
||||
|
||||
// Safely access environment variables
|
||||
const envUrl = (import.meta as any).env?.VITE_SUPABASE_URL;
|
||||
const envKey = (import.meta as any).env?.VITE_SUPABASE_ANON_KEY;
|
||||
|
||||
// Fallback to placeholder values to prevent createClient from throwing "supabaseUrl is required" error
|
||||
const supabaseUrl = envUrl || 'https://placeholder.supabase.co';
|
||||
const supabaseAnonKey = envKey || 'placeholder';
|
||||
|
||||
export const supabase = createClient(supabaseUrl, supabaseAnonKey);
|
||||
|
||||
export const isSupabaseConfigured = () => {
|
||||
return !!envUrl && !!envKey && envUrl !== '' && envKey !== '';
|
||||
};
|
||||
Reference in New Issue
Block a user