adding more persistence for the client to be able to rejoin the session on clientId

This commit is contained in:
RandyJC
2025-12-08 22:50:52 +01:00
parent 42df8f5893
commit c7d41cd7a5
3 changed files with 30 additions and 1 deletions

View File

@@ -33,6 +33,10 @@ const Username = () => {
useEvent("game:successJoin", (gameId) => {
setStatus(STATUS.WAIT, { text: "Waiting for the players" })
login(username)
try {
localStorage.setItem("last_game_id", gameId)
localStorage.setItem("last_username", username)
} catch {}
router.replace(`/game/${gameId}`)
})