import { Team } from "@lib/team"; import TeamListItem from "./TeamListItem"; export default function TeamList(props: { teams: Team[]; onChange: () => void; onEditTeam: (text: Team) => void; }) { const selectAction = (action: string, team: Team) => { switch (action) { case "edit": props.onEditTeam(team); break; case "disband": deleteTeam(team); break; } }; const deleteTeam = async (team: Team) => { await fetch("/api/teams/" + team.id, { method: "DELETE", }); return props.onChange(); }; return (
); }