From 82ff3fd2833feca3aeeb6b8de521c5e927427811 Mon Sep 17 00:00:00 2001 From: Kurdistan Tech Ministry Date: Wed, 29 Oct 2025 05:26:43 +0300 Subject: [PATCH] chore: Remove debug logging from profile operations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cleaned up console.log statements added during debugging: - Removed verbose logging from ProfileSettings loadProfile - Removed verbose logging from ProfileSettings updateProfile - Removed verbose logging from Dashboard fetchProfile Kept only essential error logging for production. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/pages/Dashboard.tsx | 9 +-------- src/pages/ProfileSettings.tsx | 34 ++++++++-------------------------- 2 files changed, 9 insertions(+), 34 deletions(-) diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index 1a8079ec..e47238e4 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -32,8 +32,6 @@ export default function Dashboard() { const fetchProfile = async () => { if (!user) return; - console.log('📥 FETCHING PROFILE for user:', user.id); - try { const { data, error } = await supabase .from('profiles') @@ -41,9 +39,6 @@ export default function Dashboard() { .eq('id', user.id) .single(); - console.log('📊 FETCHED PROFILE DATA:', data); - console.log('❌ Fetch error:', error); - if (error) throw error; // Auto-sync user metadata from Auth to profiles if missing @@ -67,7 +62,6 @@ export default function Dashboard() { // If there are fields to update, update the profile if (Object.keys(needsUpdate).length > 0) { - console.log('🔄 Syncing profile from Auth metadata:', needsUpdate); const { error: updateError } = await supabase .from('profiles') .update(needsUpdate) @@ -83,10 +77,9 @@ export default function Dashboard() { // Note: Email verification is handled by Supabase Auth (user.email_confirmed_at) // We don't store it in profiles table to avoid duplication - console.log('✅ SETTING PROFILE STATE TO:', data); setProfile(data); } catch (error) { - console.error('❌ Error fetching profile:', error); + console.error('Error fetching profile:', error); } finally { setLoading(false); } diff --git a/src/pages/ProfileSettings.tsx b/src/pages/ProfileSettings.tsx index 501abd30..b2fa34be 100644 --- a/src/pages/ProfileSettings.tsx +++ b/src/pages/ProfileSettings.tsx @@ -42,19 +42,19 @@ export default function ProfileSettings() { const loadProfile = async () => { try { - console.log('📥 LOADING PROFILE in ProfileSettings for user:', user?.id); - const { data, error } = await supabase .from('profiles') .select('*') .eq('id', user?.id) .single(); - console.log('📊 LOADED PROFILE DATA:', data); - console.log('❌ Load error:', error); + if (error) { + console.error('Error loading profile:', error); + return; + } if (data) { - const profileState = { + setProfile({ username: data.username || '', full_name: data.full_name || '', bio: data.bio || '', @@ -67,31 +67,16 @@ export default function ProfileSettings() { notifications_push: data.notifications_push ?? false, notifications_sms: data.notifications_sms ?? false, two_factor_enabled: data.two_factor_enabled ?? false - }; - - console.log('✅ SETTING PROFILE STATE TO:', profileState); - setProfile(profileState); + }); } } catch (error) { - console.error('❌ Error loading profile:', error); + console.error('Error loading profile:', error); } }; const updateProfile = async () => { setLoading(true); try { - console.log('💾 CALLING UPSERT FUNCTION with data:', { - username: profile.username || '', - full_name: profile.full_name, - bio: profile.bio, - phone_number: profile.phone_number, - location: profile.location, - website: profile.website, - language: profile.language, - theme: profile.theme - }); - console.log('👤 User ID:', user?.id); - // Call the secure upsert function const { data, error } = await supabase.rpc('upsert_user_profile', { p_username: profile.username || '', @@ -107,9 +92,6 @@ export default function ProfileSettings() { p_notifications_sms: profile.notifications_sms ?? false }); - console.log('✅ Function response data:', data); - console.log('❌ Function error:', error); - if (error) throw error; toast({ @@ -120,7 +102,7 @@ export default function ProfileSettings() { // Reload profile to ensure state is in sync await loadProfile(); } catch (error: any) { - console.error('❌ Profile update failed:', error); + console.error('Profile update failed:', error); toast({ title: 'Error', description: error?.message || 'Failed to update profile',