diff --git a/components/home.js b/components/home.js index d81b8e2..a63f24e 100644 --- a/components/home.js +++ b/components/home.js @@ -1047,11 +1047,20 @@ setShowCountryButtons(false) }, [screen, inCrazyGames]) useEffect(() => { + + if(window.location.search.includes("code=")) { + try { + window.localStorage.setItem("joinCode", window.location.search.split("code=")[1].split("&")[0]) + window.location.href = "/" + } catch(e) {} + return; + } + if(multiplayerState?.connected) { // check if joined via invite link try { - let code = inCrazyGames ? window.CrazyGames.SDK.game.getInviteParam("code") : window.location.search.includes("code=") ? window.location.search.split("code=")[1].split("&")[0] : null; + let code = inCrazyGames ? window.CrazyGames.SDK.game.getInviteParam("code") : window.localStorage.getItem("joinCode"); let instantJoin = window.location.search.includes("instantJoin");