• Custom React hook to access the authentication context.

    Throws an error if used outside of an AuthProvider.

    Returns AuthContextType

    The current authentication context value.

    export function useAuth(): AuthContextType {
    const context = useContext(AuthContext);
    if (context === undefined) {
    throw new Error("useAuth must be used within an AuthProvider");
    }
    return context;
    }