Refactor: Simplify auth and profile handling

This commit is contained in:
gpt-engineer-app[bot]
2025-10-13 17:22:56 +00:00
parent be26c08640
commit 149c0704fe
9 changed files with 78 additions and 122 deletions

View File

@@ -11,6 +11,7 @@ import { Separator } from '@/components/ui/separator';
import { Switch } from '@/components/ui/switch';
import { useToast } from '@/hooks/use-toast';
import { useAuth } from '@/hooks/useAuth';
import { useProfile } from '@/hooks/useProfile';
import { useUnitPreferences } from '@/hooks/useUnitPreferences';
import { supabase } from '@/integrations/supabase/client';
import { MapPin, Calendar, Globe, Accessibility, Ruler } from 'lucide-react';
@@ -28,14 +29,9 @@ interface AccessibilityOptions {
reduced_motion: boolean;
}
export function LocationTab() {
const {
user,
profile,
refreshProfile
} = useAuth();
const {
toast
} = useToast();
const { user } = useAuth();
const { data: profile, refreshProfile } = useProfile(user?.id);
const { toast } = useToast();
const { preferences: unitPreferences, updatePreferences: updateUnitPreferences } = useUnitPreferences();
const [loading, setLoading] = useState(false);
const [parks, setParks] = useState<any[]>([]);