From 72acde90e6d8fbffbfbd1838abb93961cabc674f Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Wed, 19 Jan 2022 13:09:14 -0800 Subject: [PATCH] fixing update the update thing for the rooms --- components/Dashboard/Rooms.tsx | 11 +++++++++++ components/LinkCard.tsx | 2 -- components/Modals/CreateOrUpdateRoom.tsx | 4 +++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/components/Dashboard/Rooms.tsx b/components/Dashboard/Rooms.tsx index 3fff893..8bf07e2 100644 --- a/components/Dashboard/Rooms.tsx +++ b/components/Dashboard/Rooms.tsx @@ -153,12 +153,23 @@ export default function DashboardRoom() { handleModalType(ShowModalType.createRoom); } + async function handleCloseModal() { + console.log("closing modal"); + + // to make sure that the next time the props changes, the modal has the updated room object + setSelectedUpdateRoom(null); + + // close the modal + handleModalType(ShowModalType.na); + } + return (
{/* modal for creating room */} {/* header */} diff --git a/components/LinkCard.tsx b/components/LinkCard.tsx index 5a9da01..5039cd9 100644 --- a/components/LinkCard.tsx +++ b/components/LinkCard.tsx @@ -118,8 +118,6 @@ export default function LinkCard(props: ILinkCardProps) { receiversNames = receivers.map((receiver) => receiver.firstName).join(", "); } - console.log(receiversNames); - return ( {/* attmnt header */} diff --git a/components/Modals/CreateOrUpdateRoom.tsx b/components/Modals/CreateOrUpdateRoom.tsx index 819501d..5fa2886 100644 --- a/components/Modals/CreateOrUpdateRoom.tsx +++ b/components/Modals/CreateOrUpdateRoom.tsx @@ -18,6 +18,7 @@ const roomService = new RoomService(); interface IModalProps { show: boolean; updateRoom: Room; + handleClose: Function; } export default function CreateOrUpdateRoomModal(props: IModalProps) { @@ -55,7 +56,8 @@ export default function CreateOrUpdateRoomModal(props: IModalProps) { const handleCloseModal = () => { resetForm(); - handleModalType(ShowModalType.na); + + props.handleClose(); }; const handleSubmit = async (e) => {