managarten/manacore/apps/mobile/utils/supabase.ts
Till-JS e7f5f942f3 chore: initial commit - consolidate 4 projects into monorepo
Projects included:
- maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing)
- manacore (Expo mobile + SvelteKit web + Astro landing)
- manadeck (NestJS backend + Expo mobile + SvelteKit web)
- memoro (Expo mobile + SvelteKit web + Astro landing)

This commit preserves the current state before monorepo restructuring.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:38:24 +01:00

36 lines
1,016 B
TypeScript

import { createClient } from '@supabase/supabase-js';
import { Platform } from 'react-native';
import memoryStorage from './memoryStorage';
const supabaseUrl = process.env.EXPO_PUBLIC_SUPABASE_URL;
const supabaseAnonKey = process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY;
// Überprüfen, ob die Umgebungsvariablen definiert sind
if (!supabaseUrl || !supabaseAnonKey) {
console.error('Supabase URL oder Anon Key fehlen in den Umgebungsvariablen');
}
// Web-spezifische Konfiguration
const webConfig = Platform.OS === 'web' ? {
global: {
headers: {
'X-Client-Info': 'supabase-js-web',
},
},
// Disable realtime for web to avoid import issues
realtime: {
params: {
eventsPerSecond: 0,
},
},
} : {};
export const supabase = createClient(supabaseUrl || '', supabaseAnonKey || '', {
auth: {
storage: memoryStorage, // Verwende benutzerdefinierte memoryStorage-Lösung
autoRefreshToken: true,
persistSession: true,
detectSessionInUrl: false,
},
...webConfig,
});