20 lines
675 B
TypeScript
20 lines
675 B
TypeScript
import "react-native-url-polyfill/auto";
|
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
import { createClient } from "@supabase/supabase-js";
|
|
import { Database } from "@/lib/database.types";
|
|
|
|
const supabaseUrl = process.env.EXPO_PUBLIC_SUPABASE_URL as string;
|
|
const supabaseAnonKey = process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY as string;
|
|
|
|
if (!supabaseUrl || !supabaseAnonKey) {
|
|
throw new Error("Missing Supabase environment variables");
|
|
}
|
|
|
|
export const supabase = createClient<Database>(supabaseUrl, supabaseAnonKey, {
|
|
auth: {
|
|
storage: AsyncStorage,
|
|
autoRefreshToken: true,
|
|
persistSession: true,
|
|
detectSessionInUrl: false,
|
|
},
|
|
});
|