fix: 创建会话, 没有user ID

hotfix/new-conversation
Lei OT 11 months ago
parent 164d09fc6d
commit 1ef696cb19

@ -1,3 +1,4 @@
import useAuthStore from '@/stores/AuthStore';
import useConversationStore from '@/stores/ConversationStore';
import { fetchOrderConversationsList, postNewConversationItem } 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);
/**
* 打开订单的会话, 不存在自动新增
*/
@ -42,7 +44,7 @@ export function useConversationNewItem() {
const newConversation = async (whatsappID, whatsappName = '') => {
const { opi_sn } = currentConversation;
const newChat = { phone_number: whatsappID, remark_name: whatsappName };
const createdNew = await postNewConversationItem({ ...newChat, opi_sn: opi_sn });
const createdNew = await postNewConversationItem({ ...newChat, opi_sn: opi_sn || userId });
addToConversationList([createdNew]);
setCurrentConversation(createdNew);
};

Loading…
Cancel
Save