diff --git a/src/components/Group.tsx b/src/components/Group.tsx index 4a6ba93..a2cef80 100644 --- a/src/components/Group.tsx +++ b/src/components/Group.tsx @@ -38,12 +38,17 @@ const SAMPLE_POOLS: Carpool.Pool[] = [ export default function Group() { // eslint-disable-next-line const { id } = useParams<{ id: string }>(); + const [error, setError] = useState(false); const [group, setGroup] = useState(); const [pools, setPools] = useState(SAMPLE_POOLS); useEffect(() => { makeAPIGetCall('/group', { groupID: id }).then((res) => { - setGroup(res.data.data); + if ('error' in res.data) { + setError(true); + } else { + setGroup(res.data.data); + } }); makeAPIGetCall('/group_pools', { groupID: id }).then((res) => { @@ -51,6 +56,10 @@ export default function Group() { }); }, [id]); + if (error) { + return

Group Not Found

; + } + if (!group) { return

Loading

; }