()
| 85 | // Fetch user profile on mount |
| 86 | useEffect(() => { |
| 87 | const fetchUserProfile = async () => { |
| 88 | if (!user || !supabase) return; |
| 89 | |
| 90 | try { |
| 91 | const { data: profile } = await supabase |
| 92 | .from('user_profiles') |
| 93 | .select('*') |
| 94 | .eq('user_id', user.id) |
| 95 | .single(); |
| 96 | |
| 97 | if (profile) { |
| 98 | setUserProfile(profile); |
| 99 | } |
| 100 | } catch (error) { |
| 101 | console.error('Error fetching user profile:', error); |
| 102 | } |
| 103 | }; |
| 104 | |
| 105 | fetchUserProfile(); |
| 106 | }, [user, supabase]); |