From c6392408cca41b8c86fd26bc28229f5287822512 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Thu, 24 Jul 2025 20:04:48 +0200 Subject: [PATCH] use actual tournament ID for sub and posting rounds --- resources/js/pages/Tournament.jsx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/resources/js/pages/Tournament.jsx b/resources/js/pages/Tournament.jsx index 8f353c1..871c706 100644 --- a/resources/js/pages/Tournament.jsx +++ b/resources/js/pages/Tournament.jsx @@ -64,7 +64,10 @@ export const Component = () => { }, [id]); useEffect(() => { - window.Echo.channel(`Tournament.${id}`) + if (!tournament) { + return; + } + window.Echo.channel(`Tournament.${tournament.id}`) .listen('ApplicationAdded', e => { if (e.application) { setTournament(tournament => patchApplication(tournament, e.application)); @@ -117,13 +120,13 @@ export const Component = () => { } }); return () => { - window.Echo.leave(`Tournament.${id}`); + window.Echo.leave(`Tournament.${tournament.id}`); }; - }, [id]); + }, [tournament?.id]); const addRound = React.useCallback(async () => { - await axios.post('/api/rounds', { tournament_id: id }); - }, [id]); + await axios.post('/api/rounds', { tournament_id: tournament.id }); + }, [tournament?.id]); const moreRounds = React.useCallback(async () => { const last_round = getLastRound(tournament); -- 2.39.5