Skip to content

Commit

Permalink
add update option for child
Browse files Browse the repository at this point in the history
  • Loading branch information
MaHaWo committed Nov 7, 2024
1 parent 9a2a60d commit 104d8e9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion frontend/src/lib/components/ChildrenDataInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
getChild,
getChildQuestions,
getCurrentChildAnswers,
updateChild,
updateCurrentChildAnswers,
uploadChildImage,
} from "$lib/client";
Expand Down Expand Up @@ -151,8 +152,21 @@ async function submitData(): Promise<void> {
} else {
currentChild.set(new_child.data.id);
}
} else {
const response = await updateChild({
body: {
name: name,
birth_year: birthyear,
birth_month: birthmonth,
has_image: image !== null,
},
});
if (response.error) {
showAlert = true;
alertMessage = $_("childData.alertMessageUpdate") + response.error.detail;
}
}
console.log("currentChild: ", $currentChild, typeof $currentChild);
// id=4 is the image upload
if (image instanceof File || image instanceof Blob) {
Expand Down

0 comments on commit 104d8e9

Please sign in to comment.