From 5c08cd6a855b21100db258a37e395de687ff4e82 Mon Sep 17 00:00:00 2001 From: Himali Malvawala <86650000+Himali-Malvawala@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:03:42 +0530 Subject: [PATCH] improve: add family member to modify profile (#296) --- src/tasks/components/RequestedChanges.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tasks/components/RequestedChanges.tsx b/src/tasks/components/RequestedChanges.tsx index 479a8c4..7a5f00d 100644 --- a/src/tasks/components/RequestedChanges.tsx +++ b/src/tasks/components/RequestedChanges.tsx @@ -28,6 +28,7 @@ export const RequestedChanges = (props: Props) => { let task: TaskInterface = { ...props.task, status: "Closed", dateClosed: new Date() }; const person = await ApiHelper.get("/people/" + props.task.associatedWithId, "MembershipApi"); let p = { ...person } as PersonInterface; + const peopleArray = [p]; requestedChanges.forEach((change) => { const value = change.value; @@ -50,10 +51,14 @@ export const RequestedChanges = (props: Props) => { case "contactInfo.homePhone": p.contactInfo.homePhone = value; break; case "contactInfo.mobilePhone": p.contactInfo.mobilePhone = value; break; case "contactInfo.workPhone": p.contactInfo.workPhone = value; break; + case "familyMember": { + const newPerson: PersonInterface = { name: { first: value, last: p.name.last }, contactInfo: {}, householdId: p.householdId }; + peopleArray.push(newPerson); + } } }); - await ApiHelper.post("/people", [p], "MembershipApi"); + await ApiHelper.post("/people", peopleArray, "MembershipApi"); await ApiHelper.post("/tasks", [task], "DoingApi"); navigate("/tasks"); };