diff --git a/frontend/src/pages/AssemblyPage.tsx b/frontend/src/pages/AssemblyPage.tsx index c8a33f6..d50abe8 100644 --- a/frontend/src/pages/AssemblyPage.tsx +++ b/frontend/src/pages/AssemblyPage.tsx @@ -11,11 +11,13 @@ import Arrow from "../assets/Arrow.svg"; import { getCurrentVotationByGroup } from "../services/votation"; import { LimitedVoteType } from "../types/votes"; import { getUserData } from "../services/organizer"; +import { NotFound } from "./NotFound"; export function AssemblyLobby() { let navigate = useNavigate(); const { groupSlug } = useParams() as { groupSlug: string }; const [groupName, setGroupName] = useState(undefined); + const [groupNotFound, setGroupNotFound] = useState(false); const [kickedOut, setKickedOut] = useState(false); const [activeVotation, setActiveVotation] = useState(false); @@ -54,6 +56,10 @@ export function AssemblyLobby() { setGroupName(group.groupName); } }); + + if (!userData.groups.some((group) => group.groupSlug == groupSlug)) { + setGroupNotFound(true); + } }; getGroupName(); isCheckedIn(); @@ -95,7 +101,10 @@ export function AssemblyLobby() { navigate("/start"); } - return ( + return groupNotFound ? ( + // Render 404 not found component if group is not found + + ) : ( <> {!checkedIn && ( ) : ( <> - Check-in for {groupName} + {groupName && Check-in for {groupName}} )}