From ef0e4ce74525080d6e0d8b822f455b322e7c3cf7 Mon Sep 17 00:00:00 2001 From: Michael Fatemi Date: Sat, 10 Apr 2021 20:28:51 -0400 Subject: [PATCH] remove warnings --- src/components/Authenticator.tsx | 2 +- src/components/Group.tsx | 33 ++++++++++-------- src/components/Pool.tsx | 2 +- src/components/Profile.tsx | 57 ++------------------------------ 4 files changed, 25 insertions(+), 69 deletions(-) diff --git a/src/components/Authenticator.tsx b/src/components/Authenticator.tsx index e0d3d59..3a1d770 100644 --- a/src/components/Authenticator.tsx +++ b/src/components/Authenticator.tsx @@ -37,7 +37,7 @@ export default function Authenticator() { .catch(() => { setStatus('errored'); }); - }, [code, provider]); + }, [code, provider, refreshAuthState]); switch (status) { case 'authenticated': diff --git a/src/components/Group.tsx b/src/components/Group.tsx index 4eddc1c..9b8a5bc 100644 --- a/src/components/Group.tsx +++ b/src/components/Group.tsx @@ -43,23 +43,30 @@ export default function Group() { makeAPIGetCall('/group', { id }).then((res) => setGroup(res.data.data)); }, [id]); + if (!group) { + return

Loading

; + } + return ( -
- Group -

+
+ + Group {group.id} + + + Pools -

- + + Create Pool -
+


{pools.map((pool, index) => { let background; diff --git a/src/components/Pool.tsx b/src/components/Pool.tsx index 58644b8..330365c 100644 --- a/src/components/Pool.tsx +++ b/src/components/Pool.tsx @@ -86,7 +86,7 @@ export default function Pool() { } }); } - }, [user]); + }, [user, id, pool]); useEffect(() => { fetch(`${process.env.REACT_APP_API_ENDPOINT}/pool/${id}`) diff --git a/src/components/Profile.tsx b/src/components/Profile.tsx index 387624b..0bbc4b7 100644 --- a/src/components/Profile.tsx +++ b/src/components/Profile.tsx @@ -19,60 +19,9 @@ const useStyles = makeStyles({ }); const Profile = () => { - const { user, isLoggedIn } = useContext(AuthenticationContext); - const [groups, setGroups] = useState([]); - const [pools, setPools] = useState([ - /* - { - id: 1, - pool_title: 'TJ Carpool', - pool_text: 'Carpool from TJ track to homes', - start_time: '4/10/2021 3:00 PM', - end_time: '4/10/2021 4:00 PM', - capacity: 2, - participants: [], - comments: [ - 'What is the covid vaccination status of all the participants?', - ], - }, - { - id: 2, - pool_title: 'TJ Carpool', - pool_text: 'Carpool from TJ track to homes', - start_time: '4/10/2021 3:00 PM', - end_time: '4/10/2021 4:00 PM', - capacity: 2, - participants: [], - comments: [ - 'What is the covid vaccination status of all the participants?', - ], - }, - { - id: 3, - pool_title: 'TJ Carpool', - pool_text: 'Carpool from TJ track to homes', - start_time: '4/10/2021 3:00 PM', - end_time: '4/10/2021 4:00 PM', - capacity: 2, - participants: [], - comments: [ - 'What is the covid vaccination status of all the participants?', - ], - }, - { - id: 4, - pool_title: 'TJ Carpool', - pool_text: 'Carpool from TJ track to homes', - start_time: '4/10/2021 3:00 PM', - end_time: '4/10/2021 4:00 PM', - capacity: 2, - participants: [], - comments: [ - 'What is the covid vaccination status of all the participants?', - ], - }, - */ - ]); + const { user } = useContext(AuthenticationContext); + // const [groups, setGroups] = useState([]); + const [pools, setPools] = useState([]); const classes = useStyles(); useEffect(() => {