mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 02:07:55 +00:00
fix: Remove email_verified update to profiles table (400 Bad Request)
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 <noreply@anthropic.com>
This commit is contained in:
+2
-12
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user