import { useContext } from "react";
import { AuthContext, AuthContextType } from "../context";

/**
 * Hook para acceder al contexto de autenticación.
 */
export const useAuth = (): AuthContextType => {
  const context = useContext(AuthContext);
  if (!context) {
    throw new Error("useAuth must be used within a AuthProvider");
  }
  return context;
};
