This repository has been archived on 2024-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
helseveileder/frontend/src/api/postEvaluationData.ts
Sindre Kjelsrud ed474d4433
🚧 working on test evaluation
Co-authored-by: haraldnilsen <harald_998@hotmail.com>
Signed-off-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
2024-01-10 13:31:02 +01:00

20 lines
446 B
TypeScript

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;
};