From 3217432b3b465187c4418b1e01230cfc5213506d Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 30 Sep 2025 08:29:31 +0000 Subject: [PATCH] Add refreshAuthState helper cgen-e4d771c7539c42949278bdaa19da2ef8 --- client/contexts/AuthContext.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/contexts/AuthContext.tsx b/client/contexts/AuthContext.tsx index 0c75d9a6..09c0bfba 100644 --- a/client/contexts/AuthContext.tsx +++ b/client/contexts/AuthContext.tsx @@ -212,6 +212,16 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ } }; + const refreshAuthState = useCallback(async () => { + try { + const { data } = await supabase.auth.getSession(); + setSession(data.session); + setUser(data.session?.user ?? null); + } catch (error) { + console.warn("Failed to refresh auth state:", error); + } + }, []); + const signIn = async (email: string, password: string) => { setLoading(true); try {