Update fetchUserProfile to return profile

cgen-0c449a09ced44482ac833ff1062417cd
This commit is contained in:
Builder.io 2025-08-06 00:32:58 +00:00
parent 21e90fcbb5
commit dd50cc9ea7

View file

@ -113,20 +113,22 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
return () => subscription.unsubscribe();
}, []);
const fetchUserProfile = async (userId: string) => {
const fetchUserProfile = async (userId: string): Promise<AethexUserProfile | null> => {
if (!isSupabaseConfigured) {
// Initialize demo data and get profile
DemoStorageService.initializeDemoData();
const demoProfile = DemoStorageService.getUserProfile();
setProfile(demoProfile as AethexUserProfile);
return;
return demoProfile as AethexUserProfile;
}
try {
const userProfile = await aethexUserService.getCurrentUser();
setProfile(userProfile);
return userProfile;
} catch (error) {
console.error('Error fetching user profile:', error);
return null;
}
};