fix errors

This commit is contained in:
Michael Fatemi 2021-04-10 20:02:33 -04:00
parent c33f655ec5
commit e61d5c8570

View File

@ -6,7 +6,7 @@ import CardContent from '@material-ui/core/CardContent';
import { makeStyles } from '@material-ui/core/styles'; import { makeStyles } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import { useContext, useEffect, useState } from 'react'; import { useContext, useEffect, useState } from 'react';
import { API_ENDPOINT } from '../api/api'; import { makeAPIGetCall } from '../api/utils';
import AuthenticationContext from './AuthenticationContext'; import AuthenticationContext from './AuthenticationContext';
const useStyles = makeStyles({ const useStyles = makeStyles({
@ -21,7 +21,8 @@ const useStyles = makeStyles({
const Profile = () => { const Profile = () => {
const { user, isLoggedIn } = useContext(AuthenticationContext); const { user, isLoggedIn } = useContext(AuthenticationContext);
const [groups, setGroups] = useState<Carpool.Group[]>([]); const [groups, setGroups] = useState<Carpool.Group[]>([]);
const [pools, setPools] = useState([ const [pools, setPools] = useState<Carpool.Pool[]>([
/*
{ {
id: 1, id: 1,
pool_title: 'TJ Carpool', pool_title: 'TJ Carpool',
@ -70,18 +71,14 @@ const Profile = () => {
'What is the covid vaccination status of all the participants?', 'What is the covid vaccination status of all the participants?',
], ],
}, },
*/
]); ]);
const classes = useStyles(); const classes = useStyles();
useEffect(() => { useEffect(() => {
console.log(process.env); makeAPIGetCall('/my_pools').then((res) => {
fetch(`${API_ENDPOINT}/my_pools`) if (res.data.data) setPools(res.data.data);
.then((response) => response.json()) });
.then((json) => {
if (json) {
setPools(json.data);
}
});
}, []); }, []);
if (!user) { if (!user) {
@ -113,14 +110,14 @@ const Profile = () => {
<CardActionArea href={'/pool/' + pool.id}> <CardActionArea href={'/pool/' + pool.id}>
<CardContent> <CardContent>
<Typography gutterBottom variant="h5" component="h2"> <Typography gutterBottom variant="h5" component="h2">
{pool.pool_title} {pool.title}
</Typography> </Typography>
<Typography <Typography
variant="body2" variant="body2"
color="textSecondary" color="textSecondary"
component="p" component="p"
> >
{pool.pool_text} {pool.description}
</Typography> </Typography>
</CardContent> </CardContent>
</CardActionArea> </CardActionArea>