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

@@ -13,6 +13,7 @@ import { Separator } from '@/components/ui/separator';
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@/components/ui/alert-dialog';
import { useToast } from '@/hooks/use-toast';
import { useAuth } from '@/hooks/useAuth';
import { useProfile } from '@/hooks/useProfile';
import { supabase } from '@/integrations/supabase/client';
import { User, Upload, Trash2, Mail, AlertCircle, X } from 'lucide-react';
import { PhotoUpload } from '@/components/upload/PhotoUpload';
@@ -36,7 +37,8 @@ const profileSchema = z.object({
type ProfileFormData = z.infer<typeof profileSchema>;
export function AccountProfileTab() {
const { user, profile, refreshProfile, pendingEmail, clearPendingEmail } = useAuth();
const { user, pendingEmail, clearPendingEmail } = useAuth();
const { data: profile, refreshProfile } = useProfile(user?.id);
const { toast } = useToast();
const [loading, setLoading] = useState(false);
const [avatarLoading, setAvatarLoading] = useState(false);