@@ -18,7 +18,7 @@ import { Buffer } from "buffer";
18
18
import data from "../data/lang_temps.json" ;
19
19
import { ToastId , useToast } from "@chakra-ui/react" ;
20
20
import { wsCollabUrl } from "../api/gateway" ;
21
- import { executionServiceClient } from "../api/server " ;
21
+ import { getExecutionResult , submitCodeForExecution } from "../api/code " ;
22
22
23
23
export type language = keyof typeof data ;
24
24
@@ -146,17 +146,18 @@ export const SharedEditorProvider = ({
146
146
const submitToServer = async ( submission : submissionRecord ) => {
147
147
// curr submission and currsubmission in state should alr be submitted
148
148
console . log ( "submitting answer to server" ) ;
149
- const res = await executionServiceClient . post ( "/api/code/submit" , {
149
+ const res = await submitCodeForExecution ( {
150
150
lang : submission . lang ,
151
151
source_code : submission . code ,
152
152
qn__id : submission . qn_id ,
153
153
uid : submission . user ,
154
- } ) ;
154
+ } )
155
+
155
156
const token = res . data . token as string ;
156
157
157
158
_states . current ?. set ( TOKEN_STATE , token ) ;
158
159
_poll_interval . current = setInterval ( async ( ) => {
159
- const res = await executionServiceClient . get ( `/api/code/result/ ${ token } ` ) ;
160
+ const res = await getExecutionResult ( token ) ;
160
161
const result = res . data as SubmissionResult ;
161
162
_states . current ?. set ( SUBMISSION_RESULT_STATE , result ) ;
162
163
if ( result . completed ) {
0 commit comments