From 98358ccb9e747a9254a710b2020873ad7533bbc7 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Wed, 6 Aug 2025 00:13:51 +0000 Subject: [PATCH] Update updateProfile method to handle unconfigured Supabase cgen-1548c43681334419b929759627270fbf --- client/contexts/AuthContext.tsx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/client/contexts/AuthContext.tsx b/client/contexts/AuthContext.tsx index 810d400c..7764ab5a 100644 --- a/client/contexts/AuthContext.tsx +++ b/client/contexts/AuthContext.tsx @@ -200,6 +200,16 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children const updateProfile = async (updates: Partial) => { if (!user) throw new Error('No user logged in'); + if (!isSupabaseConfigured) { + aethexToast.info({ + title: 'Demo Mode', + description: 'Profile updates are simulated in demo mode' + }); + // Simulate profile update + setProfile(prev => prev ? { ...prev, ...updates } : null); + return; + } + try { const { data, error } = await supabase .from('user_profiles') @@ -211,14 +221,14 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children if (error) throw error; setProfile(data); - aethexToast.success({ - title: 'Profile updated', - description: 'Your profile has been updated successfully' + aethexToast.success({ + title: 'Profile updated', + description: 'Your profile has been updated successfully' }); } catch (error: any) { - aethexToast.error({ - title: 'Update failed', - description: error.message + aethexToast.error({ + title: 'Update failed', + description: error.message }); throw error; }