@@ -14,9 +14,8 @@ export class SocketHandler extends React.Component<SocketHandlerInterfaces.Props
1414 { } ,
1515 // @ts -ignore
1616 ( frame ) => {
17- // tslint:disable-next-line:no-console
18- console . log ( 'Success call back console log' , frame ) ;
19- const { userId } = this . props ;
17+ const { userId, success } = this . props ;
18+ success ( 'Connected to Server.' ) ;
2019 // @ts -ignore
2120 this . stompClient . subscribe (
2221 `/socket/response/alert/${ userId } ` ,
@@ -29,9 +28,13 @@ export class SocketHandler extends React.Component<SocketHandlerInterfaces.Props
2928 this . stompClient . subscribe (
3029 `/socket/response/match/${ userId } ` ,
3130 ( message : { body : string } ) => {
32- // @ts -ignore
33- // tslint:disable-next-line: no-console
34- console . log ( 'Received match object' , message . body ) ;
31+ if ( message . body [ 0 ] === 'E' ) {
32+ this . props . error ( 'Match not executed successfully' ) ;
33+ this . props . updateGameLog ( message . body , message . body , '' ) ;
34+ return ;
35+ }
36+
37+ this . props . success ( 'Match executed successfully' ) ;
3538
3639 const matchDetails = {
3740 matchPlayerId : '' ,
@@ -103,9 +106,15 @@ export class SocketHandler extends React.Component<SocketHandlerInterfaces.Props
103106 }
104107
105108 public componentDidUpdate ( ) {
106- // tslint:disable-next-line: no-console
107- const { request, mapId, playerId1, playerId2, commitHash, updateRequest, userId } = this . props ;
108- // tslint:disable-next-line: no-console
109+ const {
110+ request,
111+ mapId,
112+ playerId2,
113+ commitHash,
114+ currentAiId,
115+ updateRequest,
116+ userId,
117+ } = this . props ;
109118 switch ( request ) {
110119 case SubmissionInterfaces . Request . PREVIOUS_COMMIT_MATCH : {
111120 // tslint:disable-next-line: no-console
@@ -137,9 +146,9 @@ export class SocketHandler extends React.Component<SocketHandlerInterfaces.Props
137146 // tslint:disable-next-line: no-console
138147 console . log ( 'INITIATING MATCH:SELF_MATCH' ) ;
139148 this . initiateMatch (
140- playerId1 ,
149+ userId ,
141150 playerId2 ,
142- SubmissionInterfaces . Request . SELF_MATCH ,
151+ SubmissionInterfaces . Request . MANUAL ,
143152 mapId ,
144153 commitHash ,
145154 ) ;
@@ -159,8 +168,9 @@ export class SocketHandler extends React.Component<SocketHandlerInterfaces.Props
159168 }
160169 }
161170
162- public componentWillUnmount ( ) {
163- this . socket . disconnect ( ) ;
171+ public componentWillUnmount ( ) : void {
172+ // @ts -ignore
173+ // this.stompClient.disconnect();
164174 }
165175
166176 public render ( ) {
0 commit comments