Skip to content
Snippets Groups Projects
Unverified Commit 6a766425 authored by Rahul Rodrigues's avatar Rahul Rodrigues Committed by GitHub
Browse files

extended join url to accept joinFormName to autofill join name (#5526)

* extended join url to accept joinFormName to autofill join name

* updated existing useEffect joinFormName
parent c536ca38
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@
import React, { useState, useEffect } from 'react';
import Card from 'react-bootstrap/Card';
import {
Navigate, Link, useParams,
Navigate, Link, useParams, useLocation,
} from 'react-router-dom';
import {
Button, Col, Row, Stack, Form as RegularForm,
......@@ -61,6 +61,11 @@ export default function JoinCard() {
const path = encodeURIComponent(document.location.pathname);
// get queryParams for JoinFormName
const location = useLocation();
const queryParams = new URLSearchParams(location.search);
const joinFormName = queryParams.get('joinFormName');
useEffect(() => { // set cookie to return to if needed
const date = new Date();
date.setTime(date.getTime() + (60 * 1000)); // expire the cookie in 1min
......@@ -86,10 +91,12 @@ export default function JoinCard() {
useEffect(() => {
// Default Join name to authenticated user full name.
if (currentUser?.name) {
if (joinFormName) {
methods.setValue('name', joinFormName);
} else if (currentUser?.name) {
methods.setValue('name', currentUser.name);
}
}, [currentUser?.name]);
}, [joinFormName, currentUser?.name]);
useEffect(() => {
// Room channel subscription:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment