@@ -19,25 +19,25 @@ export const setTournamentChannel = (newTournamentId = tournamentId) => {
1919 return channel ;
2020} ;
2121
22- const initTournamentChannel = dispatch => {
22+ const initTournamentChannel = ( dispatch , isAdminWidged = false ) => {
2323 const onJoinFailure = err => {
2424 console . error ( err ) ;
2525 // window.location.reload();
2626 } ;
2727
2828 const onJoinSuccess = response => {
29- // dispatch(
30- // actions.setTournamentData({
31- // ...response.tournament,
32- // topPlayerIds: response.topPlayerIds || [] ,
33- // matches: {} ,
34- // ranking: response.ranking || { entries: [] },
35- // clans : response.clans || {},
36- // players: {},
37- // showBots: response.tournament.type !== TournamentTypes.show ,
38- // playersPageSize: 20 ,
39- // }),
40- // );
29+ if ( isAdminWidged ) {
30+ dispatch (
31+ actions . setTournamentData ( {
32+ ... response . tournament ,
33+ topPlayerIds : response . topPlayerIds || [ ] ,
34+ matches : { } ,
35+ ranking : response . ranking || { entries : [ ] } ,
36+ players : { } ,
37+ playersPageSize : 20 ,
38+ } ) ,
39+ ) ;
40+ }
4141
4242 dispatch ( actions . updateTournamentRanking ( ( response . ranking ) ) ) ;
4343 dispatch ( actions . updateTournamentPlayers ( compact ( response . players ) ) ) ;
@@ -55,9 +55,9 @@ const initTournamentChannel = dispatch => {
5555
5656// export const soundNotification = notification();
5757
58- export const connectToTournament = ( _machine , newTournamentId ) => dispatch => {
58+ export const connectToTournament = ( _machine , newTournamentId , isAdminWidged = false ) => dispatch => {
5959 setTournamentChannel ( newTournamentId ) ;
60- initTournamentChannel ( dispatch ) ;
60+ initTournamentChannel ( dispatch , isAdminWidged ) ;
6161
6262 const handleUpdate = response => {
6363 dispatch ( actions . updateTournamentData ( response . tournament ) ) ;
@@ -182,6 +182,15 @@ export const uploadPlayers = playerIds => (dispatch, getState) => {
182182 }
183183} ;
184184
185+ export const requestMatchesForRound = ( ) => dispatch => {
186+ channel
187+ . push ( 'tournament:matches:request_for_round' , { } )
188+ . receive ( 'ok' , data => {
189+ dispatch ( actions . updateTournamentMatches ( data . matches ) ) ;
190+ } )
191+ . receive ( 'error' , error => console . error ( error ) ) ;
192+ } ;
193+
185194export const requestMatchesByPlayerId = userId => dispatch => {
186195 channel
187196 . push ( 'tournament:matches:request' , { playerId : userId } )
0 commit comments