Update fetchUserProfile to return profile
cgen-0c449a09ced44482ac833ff1062417cd
This commit is contained in:
parent
21e90fcbb5
commit
dd50cc9ea7
1 changed files with 4 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue