diff --git a/app/javascript/components/rooms/room/join/JoinCard.jsx b/app/javascript/components/rooms/room/join/JoinCard.jsx index dc7a5a10d7..6c4034eade 100644 --- a/app/javascript/components/rooms/room/join/JoinCard.jsx +++ b/app/javascript/components/rooms/room/join/JoinCard.jsx @@ -65,6 +65,7 @@ export default function JoinCard() { const location = useLocation(); const queryParams = new URLSearchParams(location.search); const joinFormName = queryParams.get('joinFormName'); + const viewerCode = queryParams.get('viewerCode'); useEffect(() => { // set cookie to return to if needed const date = new Date(); @@ -98,6 +99,13 @@ export default function JoinCard() { } }, [joinFormName, currentUser?.name]); + useEffect(() => { + // Default viewerCode if passed as query param + if (viewerCode) { + methods.setValue('access_code', viewerCode); + } + }, [viewerCode]); + useEffect(() => { // Room channel subscription: if (roomStatusAPI.isSuccess) {