Update fetchUserProfile to use AeThex adapter
cgen-ea71a38f54944c0c97055d8338998e97
This commit is contained in:
parent
03c7e5033c
commit
74a8b67cae
1 changed files with 3 additions and 12 deletions
|
|
@ -90,22 +90,13 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
||||||
// Initialize demo data and get profile
|
// Initialize demo data and get profile
|
||||||
DemoStorageService.initializeDemoData();
|
DemoStorageService.initializeDemoData();
|
||||||
const demoProfile = DemoStorageService.getUserProfile();
|
const demoProfile = DemoStorageService.getUserProfile();
|
||||||
setProfile(demoProfile);
|
setProfile(demoProfile as AethexUserProfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data, error } = await supabase
|
const userProfile = await aethexUserService.getCurrentUser();
|
||||||
.from('user_profiles')
|
setProfile(userProfile);
|
||||||
.select('*')
|
|
||||||
.eq('id', userId)
|
|
||||||
.single();
|
|
||||||
|
|
||||||
if (error && error.code !== 'PGRST116') {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
|
|
||||||
setProfile(data);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching user profile:', error);
|
console.error('Error fetching user profile:', error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue