Update updateProfile method to use AeThex adapter
cgen-a68e0b3357314215b8d5e80b29212eea
This commit is contained in:
parent
d40d3e2a62
commit
3897450bc2
1 changed files with 5 additions and 13 deletions
|
|
@ -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 (!isSupabaseConfigured) {
|
||||
// Use demo storage
|
||||
const updatedProfile = DemoStorageService.updateUserProfile(updates);
|
||||
setProfile(updatedProfile);
|
||||
const updatedProfile = DemoStorageService.updateUserProfile(updates as any);
|
||||
setProfile(updatedProfile as AethexUserProfile);
|
||||
aethexToast.success({
|
||||
title: 'Profile updated',
|
||||
description: 'Your profile has been updated successfully'
|
||||
|
|
@ -209,16 +209,8 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
|||
}
|
||||
|
||||
try {
|
||||
const { data, error } = await supabase
|
||||
.from('user_profiles')
|
||||
.update(updates)
|
||||
.eq('id', user.id)
|
||||
.select()
|
||||
.single();
|
||||
|
||||
if (error) throw error;
|
||||
|
||||
setProfile(data);
|
||||
const updatedProfile = await aethexUserService.updateProfile(user.id, updates);
|
||||
setProfile(updatedProfile);
|
||||
aethexToast.success({
|
||||
title: 'Profile updated',
|
||||
description: 'Your profile has been updated successfully'
|
||||
|
|
|
|||
Loading…
Reference in a new issue