diff --git a/src/components/Profile.tsx b/src/components/Profile.tsx index e647068..387624b 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 { API_ENDPOINT } from '../api/api'; +import { makeAPIGetCall } from '../api/utils'; import AuthenticationContext from './AuthenticationContext'; const useStyles = makeStyles({ @@ -21,7 +21,8 @@ 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,18 +71,14 @@ const Profile = () => { 'What is the covid vaccination status of all the participants?', ], }, + */ ]); const classes = useStyles(); useEffect(() => { - console.log(process.env); - fetch(`${API_ENDPOINT}/my_pools`) - .then((response) => response.json()) - .then((json) => { - if (json) { - setPools(json.data); - } - }); + makeAPIGetCall('/my_pools').then((res) => { + if (res.data.data) setPools(res.data.data); + }); }, []); if (!user) { @@ -113,14 +110,14 @@ const Profile = () => { - {pool.pool_title} + {pool.title} - {pool.pool_text} + {pool.description}