Skip to content

Commit

Permalink
final update
Browse files Browse the repository at this point in the history
  • Loading branch information
Su Yeon Lee committed Aug 6, 2024
1 parent 0c2fb9d commit bc7cd68
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
17 changes: 1 addition & 16 deletions client/src/Communications/CommunicationsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,22 +313,7 @@ function CommunicationsPage() {
};

const handleAddNewGroup = (newGroup: any) => {
if (newGroup) {
const newData = {
group_name: newGroup.group_name,
date_created: new Date(),
donor_ids: [],
};

postData('group/create', newData)
.then((response) => {
setGroups((prevGroups) => [...prevGroups, response.data]);
setSelectedGroup(response.data);
})
.catch((error) => {
console.log(error);
});
}
setGroups((prevGroups) => [...prevGroups, newGroup.responseData]);
};

return (
Expand Down
19 changes: 18 additions & 1 deletion client/src/components/AddEditGroupsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,24 @@ export default function AddEditGroupsModal({ open, onClose, onAddNewGroup, }: an
};

const handleAddNewGroup = (newGroup: Group) => {
onAddNewGroup({ newGroup });
if (newGroup) {
const newData = {
group_name: newGroup.group_name,
date_created: new Date(),
donor_ids: [],
};

postData('group/create', newData)
.then((response) => {
const responseData = response.data
setGroups((prevGroups) => [...prevGroups, responseData]);
setSelectedGroup(responseData);
onAddNewGroup({ responseData });
})
.catch((error) => {
console.log(error);
});
}
};

return (
Expand Down

0 comments on commit bc7cd68

Please sign in to comment.