feat: send program to backend in the latest form

ref: N25B-198
This commit is contained in:
Twirre Meulenbelt
2025-11-25 10:55:57 +01:00
parent f87c7fed03
commit 690880faa4
2 changed files with 31 additions and 10 deletions

View File

@@ -109,9 +109,20 @@ function VisualProgrammingUI() {
// currently outputs the prepared program to the console
function runProgram() {
const program = graphReducer();
console.log(program);
const phases = graphReducer();
const program = {phases}
console.log(JSON.stringify(program, null, 2));
fetch(
"http://localhost:8000/program",
{
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify(program),
}
).then((res) => {
if (!res.ok) throw new Error("Failed communicating with the backend.")
console.log("Successfully sent the program to the backend.");
}).catch(() => console.log("Failed to send program to the backend."));
}
/**