From 47f2f4c13f5e9e95fe699550638fedd0d7d459d9 Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Sat, 14 Mar 2026 23:22:28 -0300 Subject: [PATCH] Fix AuthContext issue after refactoring --- src/client/context/AuthContext.tsx | 2 ++ src/client/context/useAuth.ts | 11 +---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/client/context/AuthContext.tsx b/src/client/context/AuthContext.tsx index 3f2105c..3a83cad 100644 --- a/src/client/context/AuthContext.tsx +++ b/src/client/context/AuthContext.tsx @@ -7,6 +7,7 @@ const API_URL = getBaseUrl(); export interface AuthContextType { appUser: AppUser | null; isLoading: boolean; + isSignedIn: boolean; error: string | null; token: string | null; login: (token: string, user: AppUser) => void; @@ -99,6 +100,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children value={{ appUser, isLoading, + isSignedIn: !!appUser, error, token, login, diff --git a/src/client/context/useAuth.ts b/src/client/context/useAuth.ts index 15cb6d0..cbc97b5 100644 --- a/src/client/context/useAuth.ts +++ b/src/client/context/useAuth.ts @@ -1,10 +1 @@ -import { useContext } from 'react'; -import { AuthContext } from './AuthContextType'; - -export const useAuth = () => { - const context = useContext(AuthContext); - if (!context) { - throw new Error('useAuth must be used within an AuthProvider'); - } - return context; -}; +export { useAuth } from './AuthContext';