Update updateProfile method to use AeThex adapter

cgen-a68e0b3357314215b8d5e80b29212eea
This commit is contained in:
Builder.io 2025-08-06 00:30:27 +00:00
parent d40d3e2a62
commit 3897450bc2

View file

@ -194,13 +194,13 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
} }
}; };
const updateProfile = async (updates: Partial<UserProfile>) => { const updateProfile = async (updates: Partial<AethexUserProfile>) => {
if (!user) throw new Error('No user logged in'); if (!user) throw new Error('No user logged in');
if (!isSupabaseConfigured) { if (!isSupabaseConfigured) {
// Use demo storage // Use demo storage
const updatedProfile = DemoStorageService.updateUserProfile(updates); const updatedProfile = DemoStorageService.updateUserProfile(updates as any);
setProfile(updatedProfile); setProfile(updatedProfile as AethexUserProfile);
aethexToast.success({ aethexToast.success({
title: 'Profile updated', title: 'Profile updated',
description: 'Your profile has been updated successfully' description: 'Your profile has been updated successfully'
@ -209,16 +209,8 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
} }
try { try {
const { data, error } = await supabase const updatedProfile = await aethexUserService.updateProfile(user.id, updates);
.from('user_profiles') setProfile(updatedProfile);
.update(updates)
.eq('id', user.id)
.select()
.single();
if (error) throw error;
setProfile(data);
aethexToast.success({ aethexToast.success({
title: 'Profile updated', title: 'Profile updated',
description: 'Your profile has been updated successfully' description: 'Your profile has been updated successfully'