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

export default function Users() {
  const [users, setUsers] = useState<any[]>([]);

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

  return (
    <div>
      <h1 className="font-bold mb-4">Users</h1>
      {users.map((u) => (
        <div key={u._id} className="p-3 bg-zinc-900 rounded mb-2">
          {u.email} · {u.plan}
        </div>
      ))}
    </div>
  );
}
