Fix AuthContext issue after refactoring

This commit is contained in:
2026-03-14 23:22:28 -03:00
parent 6898297935
commit 47f2f4c13f
2 changed files with 3 additions and 10 deletions

View File

@@ -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,

View File

@@ -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';