Skip to content

Commit

Permalink
FIX: removed unused [evaluate.ts:server] function
Browse files Browse the repository at this point in the history
  • Loading branch information
LyonSyonII committed Dec 15, 2023
1 parent e94ff29 commit 107a109
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions frontend/src/components/CodeBlock/evaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,6 @@ export async function evaluate(
]).catch(() => "There was an error, please try again.");
}

async function server(code: string, error: string): Promise<string> {
const params = {
code,
};

return fetch("https://rust-quest-runner.fly.dev/evaluate.json", {
headers: {
"Content-Type": "application/json",
// "authorization": auth || "",
},
method: "POST",
body: JSON.stringify(params),
})
.then((response) => response.json())
.then((response) => {
console.log({ params, response });
return response;
})
.then((response) => {
if (response.ok) {
return response.ok.stdout;
} else {
return error || response.err.stderr;
}
})
.catch((error) => error || error.message);
}

async function godbolt(code: string, error: string): Promise<string> {
const params = {
source: code,
Expand Down Expand Up @@ -105,7 +77,7 @@ async function godbolt(code: string, error: string): Promise<string> {

const execution = response.indexOf("# Exec");
const stdout_idx = response.indexOf("# Standard out:", execution);

if (stdout_idx !== -1) {
return response.substring(stdout_idx + " Standard out:\n".length + 1);
}
Expand Down

0 comments on commit 107a109

Please sign in to comment.