From f82c38fb0557188f81c56bfca410107f9384b339 Mon Sep 17 00:00:00 2001 From: Kurdistan Tech Ministry Date: Wed, 29 Oct 2025 04:08:01 +0300 Subject: [PATCH] fix: Remove email_verified update to profiles table (400 Bad Request) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: Dashboard was throwing 400 Bad Request when updating profiles table Root Cause: - Dashboard tried to update profiles.email_verified column - But this column doesn't exist in profiles table - Migration only has: username, email, full_name, avatar_url, referral fields Solution: - Removed sync logic that updates profiles.email_verified - Email verification is now ONLY read from Supabase Auth (user.email_confirmed_at) - No need to duplicate verification status in profiles table Benefits: - No more 400 errors - Single source of truth (Supabase Auth) - Cleaner code, less database writes UI still works correctly: - Account Status card checks: user?.email_confirmed_at || profile?.email_verified - Since user.email_confirmed_at exists, profile.email_verified is never needed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/pages/Dashboard.tsx | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index 0c6ab90d..5c98cae1 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -41,18 +41,8 @@ export default function Dashboard() { if (error) throw error; - // Sync email_verified from Supabase Auth - const isEmailVerified = !!user.email_confirmed_at; - - // Update profile with Auth's verification status if different - if (data && data.email_verified !== isEmailVerified) { - await supabase - .from('profiles') - .update({ email_verified: isEmailVerified }) - .eq('id', user.id); - - data.email_verified = isEmailVerified; - } + // Note: Email verification is handled by Supabase Auth (user.email_confirmed_at) + // We don't store it in profiles table to avoid duplication setProfile(data); } catch (error) {