🚑 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:
parent
d56893e9dd
commit
db0f1f8de0
5 changed files with 41 additions and 9 deletions
|
@ -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;
|
||||
};
|
||||
|
|
Reference in a new issue