✨ added POST-endpoint for userform
Co-authored-by: haraldnilsen <harald_998@hotmail.com> Signed-off-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
parent
b78003b4fc
commit
dd8f22b043
7 changed files with 74 additions and 18 deletions
22
frontend/src/api/postFormData.ts
Normal file
22
frontend/src/api/postFormData.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
export const postFormData = (
|
||||
age: string,
|
||||
education: string,
|
||||
healthcare_personnel: string,
|
||||
gender: string
|
||||
) => {
|
||||
let url = "http://localhost:8080/submitform";
|
||||
let personnel = healthcare_personnel == "Ja" ? true : false;
|
||||
|
||||
const response = fetch(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
age: age,
|
||||
education: education,
|
||||
healthcare_personnel: personnel,
|
||||
gender: gender,
|
||||
}),
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
return response;
|
||||
};
|
Reference in a new issue