From 51e03d5dbe3d85dd74a2beff09c2c25b18f1422d Mon Sep 17 00:00:00 2001 From: Antonio De Lucreziis Date: Thu, 21 Nov 2024 15:23:54 +0100 Subject: [PATCH] fix --- src/components/AdminPage.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/AdminPage.tsx b/src/components/AdminPage.tsx index 8dadee9..8f311be 100644 --- a/src/components/AdminPage.tsx +++ b/src/components/AdminPage.tsx @@ -11,9 +11,13 @@ export const AdminPage = ({ roomId }: { roomId: string }) => { useEffect(() => { const url = new URL(location.href) - setPassword(url.searchParams.get('password')) - url.searchParams.delete('password') - history.replaceState({}, '', url.toString()) + if (url.searchParams.has('password')) { + setPassword(url.searchParams.get('password')) + + // remove password from url + url.searchParams.delete('password') + history.replaceState({}, '', url.toString()) + } }, []) const listeners = useRef void>>({})