add delete conversation mutation, fix withAuthentication on post requests

This commit is contained in:
Daniel D Orlando 2023-04-03 12:39:00 -07:00
parent bd53b878d4
commit 94e0636b32
5 changed files with 68 additions and 49 deletions

View file

@ -61,30 +61,20 @@ export default function Conversation({ conversation, retainView }) {
if (titleInput === title) {
return;
}
updateConvoMutation.mutate({ arg: { conversationId, title: titleInput }});
// rename.trigger({ conversationId, title: titleInput }).then(() => {
// refreshConversations();
// if (conversationId == currentConversation?.conversationId)
// setCurrentConversation(prevState => ({
// ...prevState,
// title: titleInput
// }));
// });
updateConvoMutation.mutate({ conversationId, title: titleInput });
};
useEffect(() => {
if (updateConvoMutation.isSuccess) {
// debugger;
refreshConversations();
if (conversationId == currentConversation?.conversationId)
setCurrentConversation(prevState => ({
...prevState,
title: titleInput
}));
}
}, [updateConvoMutation.isSuccess]);
if (updateConvoMutation.isSuccess) {
refreshConversations();
if (conversationId == currentConversation?.conversationId) {
setCurrentConversation(prevState => ({
...prevState,
title: titleInput
}));
}
}
}, [updateConvoMutation.isSuccess]);
const handleKeyDown = e => {
if (e.key === 'Enter') {