From dd50cc9ea7a74510c296d8b3a3bb8e29182f4fc2 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Wed, 6 Aug 2025 00:32:58 +0000 Subject: [PATCH] Update fetchUserProfile to return profile cgen-0c449a09ced44482ac833ff1062417cd --- client/contexts/AuthContext.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/contexts/AuthContext.tsx b/client/contexts/AuthContext.tsx index 638cdd74..451e62d9 100644 --- a/client/contexts/AuthContext.tsx +++ b/client/contexts/AuthContext.tsx @@ -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 => { 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; } };