From e61d5c8570f318477a1c83af22d808596a7cad09 Mon Sep 17 00:00:00 2001 From: Michael Fatemi Date: Sat, 10 Apr 2021 20:02:33 -0400 Subject: [PATCH] fix errors --- src/components/Profile.tsx | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) 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}