This commit is contained in:
Michael Fatemi 2021-04-10 20:00:18 -04:00
commit e2f6f1111a
2 changed files with 13 additions and 12 deletions

View File

@ -105,7 +105,7 @@ const Pools = () => {
</p> </p>
<p className="text-left">Start Time: {pool.start_time}</p> <p className="text-left">Start Time: {pool.start_time}</p>
<p className="text-left">End Time: {pool.end_time}</p> <p className="text-left">End Time: {pool.end_time}</p>
<p className="text-warning"> <p className="" style={{color: '#9E6105'}}>
{maybePluralize(pool.comments.length, 'comment')} {maybePluralize(pool.comments.length, 'comment')}
</p> </p>
</div> </div>

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 { makeAPIGetCall } from '../api/utils'; import { API_ENDPOINT } from '../api/api';
import AuthenticationContext from './AuthenticationContext'; import AuthenticationContext from './AuthenticationContext';
const useStyles = makeStyles({ const useStyles = makeStyles({
@ -21,8 +21,7 @@ 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<Carpool.Pool[]>([ const [pools, setPools] = useState([
/*
{ {
id: 1, id: 1,
pool_title: 'TJ Carpool', pool_title: 'TJ Carpool',
@ -70,15 +69,17 @@ const Profile = () => {
comments: [ comments: [
'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); console.log(process.env);
makeAPIGetCall('/my_pools').then((response) => { fetch(`${API_ENDPOINT}/my_pools`)
if (response.data.data) { .then((response) => response.json())
setPools(response.data.data); .then((json) => {
if (json) {
setPools(json.data);
} }
}); });
}, []); }, []);
@ -112,14 +113,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.title} {pool.pool_title}
</Typography> </Typography>
<Typography <Typography
variant="body2" variant="body2"
color="textSecondary" color="textSecondary"
component="p" component="p"
> >
{pool.description} {pool.pool_text}
</Typography> </Typography>
</CardContent> </CardContent>
</CardActionArea> </CardActionArea>