import Loading from '../common/Loading';
import NotFound from '../pages/NotFound';
import Detail from '../tournament/Detail';
-import { patchResult, patchRound, patchUser, sortParticipants } from '../../helpers/Tournament';
+import {
+ patchParticipant,
+ patchResult,
+ patchRound,
+ patchUser,
+ sortParticipants,
+} from '../../helpers/Tournament';
const Tournament = () => {
const params = useParams();
useEffect(() => {
window.Echo.channel(`Tournament.${id}`)
- .listen('ResultReported', e => {
+ .listen('ParticipantChanged', e => {
+ if (e.participant) {
+ setTournament(tournament => patchParticipant(tournament, e.participant));
+ }
+ })
+ .listen('ResultChanged', e => {
if (e.result) {
setTournament(tournament => patchResult(tournament, e.result));
}