import { Table, TableHeader, TableBody, TableRow, TableCell, TableColumn, Button, Icon, Icons, Flexbox, Text, } from 'react-basics'; import { useIntl } from 'react-intl'; import { ROLES } from 'lib/constants'; import { labels } from 'components/messages'; import useUser from 'hooks/useUser'; import useApi from 'hooks/useApi'; export default function TeamMembersTable({ data = [], onSave, readOnly }) { const { formatMessage } = useIntl(); const { user } = useUser(); const { del, useMutation } = useApi(); const { mutate } = useMutation(data => del(`/teamUsers/${data.teamUserId}`)); const columns = [ { name: 'username', label: formatMessage(labels.username), style: { flex: 2 } }, { name: 'role', label: formatMessage(labels.role), style: { flex: 1 } }, { name: 'action', label: '', style: { flex: 1 } }, ]; const handleRemoveTeamMember = teamUserId => { mutate( { teamUserId }, { onSuccess: async () => { onSave(); }, }, ); }; return (