import { useEffect, useState } from "react";
import api from "../api";

export default function Anomalies() {
  const [data, setData] = useState<any[]>([]);

  useEffect(()=>{ api.get("/admin/security/anomalies").then(r=>setData(r.data)); },[]);

  return (
    <>
      <h1 className="font-bold mb-4">ML Anomalies</h1>
      {data.map(l=>(
        <div key={l._id} className="p-3 bg-red-900/40 rounded mb-2">
          🤖 {l.action}
          <div className="text-sm text-zinc-400">{l.ip}</div>
        </div>
      ))}
    </>
  );
}
