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