🚑 added respondentId to POST-endpoint

Co-authored-by: haraldnilsen <harald_998@hotmail.com>
Signed-off-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
Sindre Kjelsrud 2023-12-23 16:26:00 +01:00
parent d56893e9dd
commit db0f1f8de0
Signed by untrusted user who does not match committer: sidski
GPG key ID: D2BBDF3EDE6BA9A6
5 changed files with 41 additions and 9 deletions

View file

@ -15,8 +15,20 @@ export const postFormData = (
healthcare_personnel: personnel,
gender: gender,
}),
}).catch((error) => {
console.log(error);
});
})
.then((response) => {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.json();
})
.then((data) => {
console.log(data);
localStorage.setItem("RespondentId", data);
return data;
})
.catch((error) => {
console.log(error);
});
return response;
};