From 664753577b8fe930e9feb921bf2ed6e6b8ac2e59 Mon Sep 17 00:00:00 2001 From: Michael Fatemi Date: Sat, 10 Apr 2021 22:01:50 -0400 Subject: [PATCH] add groups to profile --- src/App.tsx | 2 +- src/components/Profile.tsx | 28 +++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 30bccd2..1308770 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -27,11 +27,11 @@ function App() { - + diff --git a/src/components/Profile.tsx b/src/components/Profile.tsx index 54ad93f..b9c7dee 100644 --- a/src/components/Profile.tsx +++ b/src/components/Profile.tsx @@ -20,7 +20,7 @@ const useStyles = makeStyles({ const Profile = () => { const { user } = useContext(AuthenticationContext); - // const [groups, setGroups] = useState([]); + const [groups, setGroups] = useState([]); const [pools, setPools] = useState([]); const classes = useStyles(); @@ -28,6 +28,10 @@ const Profile = () => { makeAPIGetCall('/users/@me/pools').then((res) => { if (res.data.data) setPools(res.data.data); }); + + makeAPIGetCall('/users/@me/groups').then((res) => { + if (res.data.data) setGroups(res.data.data); + }); }, []); if (!user) { @@ -47,9 +51,9 @@ const Profile = () => {

- {user.username}'s Pools + My Pools (private)

-
+
{pools.map((pool) => { return ( { ); })}
+ +

+ My Groups (private) +
+ {groups.map((group) => { + return ( + +

+ {group.name} +

+
+ ); + })} +
+

);