Commit 25a203d1 authored by insert's avatar insert

Add actual h/w list

parent 80d61881
......@@ -11,6 +11,7 @@ import EditIcon from '@material-ui/icons/Edit';
import CloseIcon from '@material-ui/icons/Close';
import DeleteIcon from '@material-ui/icons/Delete';
import { SubjectIcon } from './util/Icon';
import Axios from 'axios';
const Transition = React.forwardRef<unknown, TransitionProps>(function Transition(props, ref) {
return <Slide direction="up" ref={ref} {...props} />;
......@@ -24,6 +25,19 @@ export default () => {
let [ open, setOpen ] = useState(false);
const handleClose = () => setOpen(false);
let [ assignments, setAssignments ] = useState<any[]>([]);
let [ loading, setLoading ] = useState(0);
if (loading === 0) {
setLoading(1);
Axios.get('/api/homework/list')
.then(x => {
setAssignments(x.data);
setLoading(2);
});
}
return (
<Fragment>
<Container component="main" maxWidth="xs">
......@@ -88,6 +102,29 @@ export default () => {
)
}
</List>
<Typography variant="overline">
actual assignments
</Typography>
{
loading < 2 ?
<Typography variant="overline">
loading
</Typography>
:
assignments.map(x =>
<List>
<ListItem button>
<ListItemIcon>
<SubjectIcon subject={x.subject} />
</ListItemIcon>
<ListItemText
primary={`${x.subject}: ${x.title}`}
secondary={x.description}
/>
</ListItem>
</List>
)
}
</div>
</Container>
<Dialog
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment