diff --git a/src/pages/Directory/Directory.jsx b/src/pages/Directory/Directory.jsx index f389167c..e7396339 100644 --- a/src/pages/Directory/Directory.jsx +++ b/src/pages/Directory/Directory.jsx @@ -23,13 +23,14 @@ const Directory = () => { const contacts_cache = getCachedData("contacts") || []; if (selectedContact) { - setSelectedContact(null); + response = await DirectoryRepository.UpdateContact(data.id, data); updatedContacts = contacts_cache.map((contact) => contact.id === data.id ? response.data : contact ); showToast("Contact updated successfully", "success"); - setIsOpenModal(false); + setIsOpenModal( false ); + setSelectedContact(null); } else { response = await DirectoryRepository.CreateContact(data); updatedContacts = [...contacts_cache, response.data];