@@ -91,17 +91,14 @@ const GameRoom = () => {
91
91
roomId,
92
92
language,
93
93
code,
94
+ socketId : socketRef . current ?. id ,
94
95
} ;
95
96
96
97
try {
97
98
const response : any = await apiClient . post ( "/execute/run" , payload ) ;
98
99
console . log ( "Run Output:" , response ) ;
99
- setConsoleOutput ( response ) ;
100
100
} catch ( error ) {
101
101
console . error ( "Error executing code:" , error ) ;
102
- } finally {
103
- setIsRunLoading ( false ) ;
104
- setIsSubmitLoading ( false ) ;
105
102
}
106
103
}
107
104
} ;
@@ -121,16 +118,14 @@ const GameRoom = () => {
121
118
roomId,
122
119
language,
123
120
code,
121
+ socketId : socketRef . current ?. id ,
124
122
} ;
125
123
126
124
try {
127
125
const response : any = await apiClient . post ( "/execute/submit" , payload ) ;
128
126
console . log ( "Run Output:" , response ) ;
129
127
} catch ( error ) {
130
128
console . error ( "Error executing code:" , error ) ;
131
- } finally {
132
- setIsRunLoading ( false ) ;
133
- setIsSubmitLoading ( false ) ;
134
129
}
135
130
}
136
131
} ;
@@ -259,6 +254,18 @@ const GameRoom = () => {
259
254
} ) ;
260
255
} ) ;
261
256
257
+ socket . on ( "compilationResponse" , ( data ) => {
258
+ setConsoleOutput ( {
259
+ stdout : data . stdout . split ( "\n" ) ,
260
+ stderr : data . stderr . split ( "\n" ) ,
261
+ execTime : data . execTime ,
262
+ timedOut : false ,
263
+ submissionId : data . submissionId ,
264
+ } ) ;
265
+ setIsRunLoading ( false ) ;
266
+ setIsSubmitLoading ( false ) ;
267
+ } ) ;
268
+
262
269
socket . on ( "tokenExpired" , async ( ) => {
263
270
console . log ( "Token expired, refreshing..." ) ;
264
271
const newToken = await refreshAccessToken ( ) ;
@@ -426,9 +433,8 @@ const GameRoom = () => {
426
433
< option value = "cpp" > C++</ option >
427
434
< option value = "csharp" > C#</ option >
428
435
< option value = "ruby" > Ruby</ option >
429
- < option value = "go" > Go</ option >
430
- < option value = "rust" > Rust</ option >
431
- < option value = "ocaml" > OCaml</ option >
436
+ < option value = "javascript" > JavaScript</ option >
437
+ < option value = "typescript" > TypeScript</ option >
432
438
</ select >
433
439
</ div >
434
440
</ div >
@@ -486,7 +492,7 @@ const GameRoom = () => {
486
492
< div > stdout</ div >
487
493
< div className = "game-room-console-output" >
488
494
{ consoleOutput . stdout . map ( ( output : any , index ) => (
489
- < div key = { index } > { output . text } </ div >
495
+ < div key = { index } > { output } </ div >
490
496
) ) }
491
497
</ div >
492
498
</ div >
@@ -495,7 +501,7 @@ const GameRoom = () => {
495
501
< div > stderr</ div >
496
502
< div className = "game-room-console-output" >
497
503
{ consoleOutput . stderr . map ( ( output : any , index ) => (
498
- < div key = { index } > { output . text } </ div >
504
+ < div key = { index } > { output } </ div >
499
505
) ) }
500
506
</ div >
501
507
</ div >
0 commit comments