]> git.localhorst.tv Git - alttp.git/blobdiff - resources/js/components/pages/Tournament.js
lock tournaments
[alttp.git] / resources / js / components / pages / Tournament.js
index a5c43caf01f604055b1c077a08862fe7766f24b9..11dc388c67d60c3832a977a7265a93033b7010ee 100644 (file)
@@ -34,7 +34,7 @@ const Tournament = () => {
        }, [id]);
 
        useEffect(() => {
-               window.Echo.private(`Tournament.${id}`)
+               window.Echo.channel(`Tournament.${id}`)
                        .listen('ResultReported', e => {
                                if (e.result) {
                                        setTournament(tournament => patchResult(tournament, e.result));
@@ -52,6 +52,11 @@ const Tournament = () => {
                                if (e.round) {
                                        setTournament(tournament => patchRound(tournament, e.round));
                                }
+                       })
+                       .listen('TournamentChanged', e => {
+                               if (e.tournament) {
+                                       setTournament(tournament => ({ ...tournament, ...e.tournament }));
+                               }
                        });
                return () => {
                        window.Echo.leave(`Tournament.${id}`);