Skip to content

Commit

Permalink
improve: add family member to modify profile (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
Himali-Malvawala authored Nov 25, 2024
1 parent f61149f commit 5c08cd6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/tasks/components/RequestedChanges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
};
Expand Down

0 comments on commit 5c08cd6

Please sign in to comment.