feat(game): enhance game reconnection logic and improve reset messages

This commit is contained in:
Ralex
2025-10-25 16:38:07 +02:00
parent dbefaa0557
commit 74707749aa
11 changed files with 114 additions and 76 deletions
+5 -4
View File
@@ -49,10 +49,11 @@ const Game = () => {
reset()
})
useEvent("game:reset", () => {
useEvent("game:reset", (message) => {
router.replace("/")
reset()
toast("The game has been reset by the host")
setQuestionStates(null)
toast.error(message)
})
if (!gameIdParam) {
@@ -61,7 +62,7 @@ const Game = () => {
let component = null
switch (status.name) {
switch (status?.name) {
case STATUS.WAIT:
component = <Wait data={status.data} />
@@ -93,7 +94,7 @@ const Game = () => {
break
}
return <GameWrapper statusName={status.name}>{component}</GameWrapper>
return <GameWrapper statusName={status?.name}>{component}</GameWrapper>
}
export default Game