|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
import useAuthStore from '@/stores/AuthStore';
|
|
|
|
|
import useConversationStore from '@/stores/ConversationStore';
|
|
|
|
|
import { fetchConversationsList, fetchOrderConversationsList, postNewOrEditConversationItem } from '@/actions/ConversationActions';
|
|
|
|
|
import { isEmpty } from '@/utils/commons';
|
|
|
|
@ -8,6 +9,7 @@ export function useConversationNewItem() {
|
|
|
|
|
]);
|
|
|
|
|
const conversationsList = useConversationStore((state) => state.conversationsList);
|
|
|
|
|
const addToConversationList = useConversationStore((state) => state.addToConversationList);
|
|
|
|
|
const userId = useAuthStore((state) => state.loginUser.userId);
|
|
|
|
|
/**
|
|
|
|
|
* 打开订单的会话, 不存在自动新增
|
|
|
|
|
*/
|
|
|
|
@ -47,7 +49,7 @@ export function useConversationNewItem() {
|
|
|
|
|
guest_phone: body.phone_number || '',
|
|
|
|
|
guest_name: body.name || '',
|
|
|
|
|
}
|
|
|
|
|
const createdNew = await postNewOrEditConversationItem({ ...newChat, opisn, conversationid });
|
|
|
|
|
const createdNew = await postNewOrEditConversationItem({ ...newChat, opi_sn: opisn || userId, conversationid });
|
|
|
|
|
// addToConversationList([{...createdNew, sn: createdNew.conversationid}]);
|
|
|
|
|
const _list = await fetchConversationsList({ opisn });
|
|
|
|
|
addToConversationList(_list);
|
|
|
|
|