|
|
|
@ -79,12 +79,13 @@ export function useConversationNewItem() {
|
|
|
|
|
}
|
|
|
|
|
const createdNew = await postNewOrEditConversationItem({ ...newChat, opisn: opisn || userId, conversationid });
|
|
|
|
|
// addToConversationList([{...createdNew, sn: createdNew.conversationid}]);
|
|
|
|
|
const _list = await fetchConversationsList({ opisn });
|
|
|
|
|
addToConversationList(_list);
|
|
|
|
|
if (!body.conversationid) {
|
|
|
|
|
const newChat = _list.find((item) => item.sn === createdNew.conversationid)
|
|
|
|
|
if (isEmpty(newChat)) {
|
|
|
|
|
setCurrentConversation({
|
|
|
|
|
// const _list = await fetchConversationsList({ opisn });
|
|
|
|
|
// addToConversationList(_list, 'top');
|
|
|
|
|
if (isEmpty(body.conversationid)) {
|
|
|
|
|
// const newChat = _list.find((item) => item.sn === createdNew.conversationid)
|
|
|
|
|
const newChat = createdNew;
|
|
|
|
|
if (!isEmpty(newChat)) {
|
|
|
|
|
const buildChatItem = {
|
|
|
|
|
...CHAT_ITEM_RECORD,
|
|
|
|
|
...createdNew,
|
|
|
|
|
sn: createdNew.conversationid,
|
|
|
|
@ -96,13 +97,16 @@ export function useConversationNewItem() {
|
|
|
|
|
conversation_memo: createdNew.remark,
|
|
|
|
|
lasttime: createdNew.session_creatime,
|
|
|
|
|
show_default: createdNew.remark || createdNew.guest_name || createdNew.guest_phone || createdNew.guest_email || createdNew.whatsapp_phone_number || '',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setCurrentConversation(buildChatItem);
|
|
|
|
|
addToConversationList([buildChatItem], 'top');
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
setCurrentConversation({
|
|
|
|
|
...newChat,
|
|
|
|
|
show_default: newChat.conversation_memo || newChat.whatsapp_name || newChat?.channels?.whatsapp_phone_number || newChat?.channels?.phone_number || newChat?.channels?.email || '',
|
|
|
|
|
})
|
|
|
|
|
// setCurrentConversation({
|
|
|
|
|
// ...newChat,
|
|
|
|
|
// show_default: newChat.conversation_memo || newChat.whatsapp_name || newChat?.channels?.whatsapp_phone_number || newChat?.channels?.phone_number || newChat?.channels?.email || '',
|
|
|
|
|
// })
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|