X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fpages%2FTournament.js;h=440e53af5803cddc65af01287617d47645c6383d;hb=3a774bb649734fc3a2135ec1b52cef9a049880ee;hp=6e32227ab2d04d330b8025dc16744fdbbee5d606;hpb=920f11ddfeb2175e4e1556886773dcd044c6085b;p=alttp.git diff --git a/resources/js/components/pages/Tournament.js b/resources/js/components/pages/Tournament.js index 6e32227..440e53a 100644 --- a/resources/js/components/pages/Tournament.js +++ b/resources/js/components/pages/Tournament.js @@ -7,7 +7,14 @@ import ErrorMessage from '../common/ErrorMessage'; import Loading from '../common/Loading'; import NotFound from '../pages/NotFound'; import Detail from '../tournament/Detail'; -import { patchResult, patchRound, patchUser, sortParticipants } from '../../helpers/Tournament'; +import { + patchApplication, + patchParticipant, + patchResult, + patchRound, + patchUser, + sortParticipants, +} from '../../helpers/Tournament'; const Tournament = () => { const params = useParams(); @@ -35,7 +42,22 @@ const Tournament = () => { useEffect(() => { window.Echo.channel(`Tournament.${id}`) - .listen('ResultReported', e => { + .listen('ApplicationAdded', e => { + if (e.application) { + setTournament(tournament => patchApplication(tournament, e.application)); + } + }) + .listen('ApplicationChanged', e => { + if (e.application) { + setTournament(tournament => patchApplication(tournament, e.application)); + } + }) + .listen('ParticipantChanged', e => { + if (e.participant) { + setTournament(tournament => patchParticipant(tournament, e.participant)); + } + }) + .listen('ResultChanged', e => { if (e.result) { setTournament(tournament => patchResult(tournament, e.result)); }