]> git.localhorst.tv Git - alttp.git/commitdiff
use actual tournament ID for sub and posting rounds
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 24 Jul 2025 18:04:48 +0000 (20:04 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 24 Jul 2025 18:04:48 +0000 (20:04 +0200)
resources/js/pages/Tournament.jsx

index 8f353c1bd2117bb9da2544f444b8b88b77fcf7fb..871c70684ebbfd255142a4b8e4be6de2f4447429 100644 (file)
@@ -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);