diff --git a/client/src/context/AuthContext.tsx b/client/src/context/AuthContext.tsx index c74baa2..18c7948 100644 --- a/client/src/context/AuthContext.tsx +++ b/client/src/context/AuthContext.tsx @@ -14,6 +14,8 @@ interface AuthContextType { const AuthContext = createContext(undefined); +export { AuthContext }; + export function AuthProvider({ children }: { children: React.ReactNode }) { const [user, setUser] = useState(null); const [isLoading, setIsLoading] = useState(true); diff --git a/client/src/hooks/useAuth.ts b/client/src/hooks/useAuth.ts index b6ff8d4..a7ddc85 100644 --- a/client/src/hooks/useAuth.ts +++ b/client/src/hooks/useAuth.ts @@ -1,10 +1 @@ -import { useContext } from "react"; -import { AuthContext } from "@/context/AuthContext"; - -export function useAuth() { - const context = useContext(AuthContext); - if (context === undefined) { - throw new Error("useAuth must be used within an AuthProvider"); - } - return context; -} +export { useAuth } from "@/context/AuthContext"; diff --git a/client/src/pages/LandingPage.tsx b/client/src/pages/LandingPage.tsx index abbb8bf..accf71a 100644 --- a/client/src/pages/LandingPage.tsx +++ b/client/src/pages/LandingPage.tsx @@ -25,7 +25,7 @@ import { export default function LandingPage() { const [, setLocation] = useLocation(); - const { user } = useAuth() || {}; + const { user } = useAuth(); const { isListening, startListening, stopListening, isSupported } = useVoice(); const { theme } = useTheme();