import React, { useState } from 'react'; import MainToobar from '../MainToolbar'; import { useHistory } from 'react-router-dom'; import { TableContainer, Table, TableRow, TableCell, TableHead, TableBody, makeStyles } from '@material-ui/core'; import t from '../common/localization'; import formatter from '../common/formatter'; import { useEffectAsync } from '../reactHelper'; const useStyles = makeStyles(theme => ({ root: { height: '100%', display: 'flex', flexDirection: 'column', }, content: { flex: 1, overflow: 'auto', padding: theme.spacing(2), }, form: { padding: theme.spacing(1, 2, 2), }, })); const UsersPage = () => { const history = useHistory(); const classes = useStyles(); const [data, setData] = useState([]); useEffectAsync(async () => { const response = await fetch('/api/users'); if (response.ok) { setData(await response.json()); } }, []); return (
{t('sharedName')} {t('userEmail')} {t('userAdmin')} {t('sharedDisabled')} {data.map((item) => ( {formatter(item, 'name')} {formatter(item, 'email')} {formatter(item, 'administrator')} {formatter(item, 'disabled')} ))}
); } export default UsersPage;