Envoie le langage au serveur

pull/2/head
Hugo PRADIER 1 year ago
parent cfea56891d
commit 62a99938bb

@ -62,15 +62,15 @@ export class EditorComponent implements OnInit{
onRunButtonClicked() {
// Le code à exécuter est le contenu de l'éditeur
const codeToExecute = this.editorContent;
this.codeExecutionService.executeCode(codeToExecute).subscribe(
this.codeExecutionService.executeCode(codeToExecute, this.mode).subscribe(
(response) => {
console.log('Réponse du serveur:', response);
console.log('Code qui va être exécuté:', codeToExecute);
// Redirigez vers une autre page (par exemple, 'output')
this.router.navigate(['/output']);
},
},
(error) => {
console.error('Erreur lors de l\'exécution du code:', error);
}

@ -10,7 +10,7 @@ export class CodeExecutionService {
constructor(private http: HttpClient) {}
executeCode(code: string): Observable<any> {
return this.http.post<any>(this.apiUrl, { code });
executeCode(code: string, language: string): Observable<any> {
return this.http.post<any>(this.apiUrl, { code, language });
}
}
}

Loading…
Cancel
Save