From 1ef696cb193cfd91f6fccef3d21528bcc4c5b5fe Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 5 Nov 2024 11:46:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=9B=E5=BB=BA=E4=BC=9A=E8=AF=9D,=20?= =?UTF-8?q?=E6=B2=A1=E6=9C=89user=20ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useConversation.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hooks/useConversation.js b/src/hooks/useConversation.js index 7f2c693..d55b92d 100644 --- a/src/hooks/useConversation.js +++ b/src/hooks/useConversation.js @@ -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); };