Store and get name of the participant from localstorage
This commit is contained in:
parent
9f8ad81ae8
commit
7a09e7cdee
|
|
@ -38,7 +38,9 @@ export const HairCheck = () => {
|
||||||
const [waiting, setWaiting] = useState(false);
|
const [waiting, setWaiting] = useState(false);
|
||||||
const [joining, setJoining] = useState(false);
|
const [joining, setJoining] = useState(false);
|
||||||
const [denied, setDenied] = useState();
|
const [denied, setDenied] = useState();
|
||||||
const [userName, setUserName] = useState('');
|
const [userName, setUserName] = useState(
|
||||||
|
localStorage.getItem('PLUOT_PARTICIPANT_NAME') || ''
|
||||||
|
);
|
||||||
|
|
||||||
// Initialise devices (even though we're not yet in a call)
|
// Initialise devices (even though we're not yet in a call)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -72,6 +74,7 @@ export const HairCheck = () => {
|
||||||
if (granted) {
|
if (granted) {
|
||||||
// Note: we don't have to do any thing here as the call state will mutate
|
// Note: we don't have to do any thing here as the call state will mutate
|
||||||
console.log('👋 Access granted');
|
console.log('👋 Access granted');
|
||||||
|
localStorage.setItem('PLUOT_PARTICIPANT_NAME', userName);
|
||||||
} else {
|
} else {
|
||||||
console.log('❌ Access denied');
|
console.log('❌ Access denied');
|
||||||
setDenied(true);
|
setDenied(true);
|
||||||
|
|
@ -187,6 +190,7 @@ export const HairCheck = () => {
|
||||||
placeholder="Enter display name"
|
placeholder="Enter display name"
|
||||||
variant="dark"
|
variant="dark"
|
||||||
disabled={joining}
|
disabled={joining}
|
||||||
|
value={userName}
|
||||||
onChange={(e) => setUserName(e.target.value)}
|
onChange={(e) => setUserName(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue