From: Daniel Karbach Date: Thu, 24 Jul 2025 18:04:48 +0000 (+0200) Subject: use actual tournament ID for sub and posting rounds X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;h=c6392408cca41b8c86fd26bc28229f5287822512;p=alttp.git use actual tournament ID for sub and posting rounds --- 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);