Update the URL the lobby view when the password changes

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2023-08-04 14:01:13 +02:00
parent 1a5898eb30
commit 59653fea07

View File

@@ -79,6 +79,17 @@ export const LobbyView: FC<Props> = ({
[setE2EESharedKey]
);
useEffect(() => {
const originalHash = location.hash;
let hash = originalHash === "" ? "#" : originalHash;
hash = hash.split("?password=")[0];
hash += `?password=${e2eeSharedKey ?? ""}`;
if (originalHash !== hash) {
location.replace(hash);
}
}, [e2eeSharedKey]);
return (
<div className={styles.room}>
{!hideHeader && (