fix update and delete bug

pull/573/head
Alex 9 months ago
parent 344692f9f6
commit c969e9c014

@ -88,12 +88,6 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
method: 'POST', method: 'POST',
}) })
.then(() => { .then(() => {
// remove the image element from the DOM
const imageElement = document.querySelector(
`#img-${id}`,
) as HTMLElement;
const parentElement = imageElement.parentNode as HTMLElement;
parentElement.parentNode?.removeChild(parentElement);
fetchConversations(); fetchConversations();
}) })
.catch((error) => console.error(error)); .catch((error) => console.error(error));
@ -239,9 +233,9 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
</NavLink> </NavLink>
<div className="conversations-container max-h-[25rem] overflow-y-auto"> <div className="conversations-container max-h-[25rem] overflow-y-auto">
{conversations {conversations
? conversations.map((conversation, index) => ( ? conversations.map((conversation) => (
<ConversationTile <ConversationTile
key={index} key={conversation.id}
conversation={conversation} conversation={conversation}
selectConversation={(id) => handleConversationClick(id)} selectConversation={(id) => handleConversationClick(id)}
onDeleteConversation={(id) => handleDeleteConversation(id)} onDeleteConversation={(id) => handleDeleteConversation(id)}

Loading…
Cancel
Save