diff --git a/src/components/Pools.tsx b/src/components/Pools.tsx index b5c1457..f7a5d1a 100644 --- a/src/components/Pools.tsx +++ b/src/components/Pools.tsx @@ -105,7 +105,7 @@ const Pools = () => {

Start Time: {pool.start_time}

End Time: {pool.end_time}

-

+

{maybePluralize(pool.comments.length, 'comment')}

diff --git a/src/components/Profile.tsx b/src/components/Profile.tsx index 2f68f03..973c036 100644 --- a/src/components/Profile.tsx +++ b/src/components/Profile.tsx @@ -6,7 +6,7 @@ import CardContent from '@material-ui/core/CardContent'; import { makeStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import { useContext, useEffect, useState } from 'react'; -import { makeAPIGetCall } from '../api/utils'; +import { API_ENDPOINT } from '../api/api'; import AuthenticationContext from './AuthenticationContext'; const useStyles = makeStyles({ @@ -21,8 +21,7 @@ const useStyles = makeStyles({ const Profile = () => { const { user, isLoggedIn } = useContext(AuthenticationContext); const [groups, setGroups] = useState([]); - const [pools, setPools] = useState([ - /* + const [pools, setPools] = useState([ { id: 1, pool_title: 'TJ Carpool', @@ -70,17 +69,19 @@ const Profile = () => { comments: [ 'What is the covid vaccination status of all the participants?', ], - },*/ + }, ]); const classes = useStyles(); useEffect(() => { console.log(process.env); - makeAPIGetCall('/my_pools').then((response) => { - if (response.data.data) { - setPools(response.data.data); - } - }); + fetch(`${API_ENDPOINT}/my_pools`) + .then((response) => response.json()) + .then((json) => { + if (json) { + setPools(json.data); + } + }); }, []); if (!user) { @@ -112,14 +113,14 @@ const Profile = () => { - {pool.title} + {pool.pool_title} - {pool.description} + {pool.pool_text}