Update src/admin/Security.tsx
Browse files- src/admin/Security.tsx +7 -7
src/admin/Security.tsx
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
import { useEffect, useState } from "react";
|
| 2 |
import api from "../api";
|
|
|
|
| 3 |
|
| 4 |
export default function Security() {
|
| 5 |
const [logs, setLogs] = useState<any[]>([]);
|
| 6 |
|
| 7 |
-
useEffect(() =>
|
| 8 |
-
|
| 9 |
-
|
| 10 |
|
| 11 |
return (
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
{logs.map((l) => (
|
| 15 |
<div key={l._id} className="bg-red-900/40 p-2 rounded mb-2">
|
| 16 |
馃 {l.action} 路 {l.ip}
|
| 17 |
</div>
|
| 18 |
))}
|
| 19 |
-
|
| 20 |
);
|
| 21 |
}
|
|
|
|
| 1 |
import { useEffect, useState } from "react";
|
| 2 |
import api from "../api";
|
| 3 |
+
import EmptyState from "../components/EmptyState";
|
| 4 |
|
| 5 |
export default function Security() {
|
| 6 |
const [logs, setLogs] = useState<any[]>([]);
|
| 7 |
|
| 8 |
+
useEffect(()=>{ api.get("/admin/security/anomalies").then(r=>setLogs(r.data)); },[]);
|
| 9 |
+
|
| 10 |
+
if (!logs.length) return <EmptyState text="No security events" />;
|
| 11 |
|
| 12 |
return (
|
| 13 |
+
<>
|
| 14 |
+
{logs.map(l=>(
|
|
|
|
| 15 |
<div key={l._id} className="bg-red-900/40 p-2 rounded mb-2">
|
| 16 |
馃 {l.action} 路 {l.ip}
|
| 17 |
</div>
|
| 18 |
))}
|
| 19 |
+
</>
|
| 20 |
);
|
| 21 |
}
|