🚧 working on test evaluation
Co-authored-by: haraldnilsen <harald_998@hotmail.com> Signed-off-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
parent
113b0fb4b7
commit
ed474d4433
4 changed files with 129 additions and 0 deletions
20
frontend/src/api/postEvaluationData.ts
Normal file
20
frontend/src/api/postEvaluationData.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
export const postEvaluationData = (evaluationText: string) => {
|
||||
let url = "http://localhost:8080/submiteval";
|
||||
|
||||
const response = fetch(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
evaluationText: evaluationText,
|
||||
}),
|
||||
})
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
}
|
||||
return response.ok;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
return response;
|
||||
};
|
||||
Reference in a new issue