222
This commit is contained in:
+4
-4
@@ -1,4 +1,4 @@
|
||||
#VITE_API_BASE_URL = http://localhost:5202/api
|
||||
#VITE_SIGNALR_BASE_URL = http://localhost:5202/chat/
|
||||
VITE_API_BASE_URL = https://im.test.nxsir.cn/api
|
||||
VITE_SIGNALR_BASE_URL = https://im.test.nxsir.cn/chat/
|
||||
VITE_API_BASE_URL = http://localhost:5202/api
|
||||
VITE_SIGNALR_BASE_URL = http://localhost:5202/chat/
|
||||
#VITE_API_BASE_URL = https://im.test.nxsir.cn/api
|
||||
#VITE_SIGNALR_BASE_URL = https://im.test.nxsir.cn/chat/
|
||||
@@ -5,12 +5,13 @@ import { useChatStore } from "@/stores/chat";
|
||||
import { messageHandler } from "@/handler/messageHandler";
|
||||
import { generateSessionId } from "../sessionIdTools";
|
||||
import { useConversationStore } from "@/stores/conversation";
|
||||
import { MESSAGE_TYPE } from "@/constants/MessageType";
|
||||
|
||||
export const SignalRMessageHandler = (data) => {
|
||||
const msg = data.data;
|
||||
const chatStore = useChatStore()
|
||||
const browserNotification = useBrowserNotification();
|
||||
const sessionId = generateSessionId(msg.senderId, msg.receiverId);
|
||||
const sessionId = generateSessionId(msg.senderId, msg.receiverId, msg.chatType == MESSAGE_TYPE.GROUP);
|
||||
messageHandler(msg);
|
||||
chatStore.pushAndSortMessagesAsync([msg], sessionId);
|
||||
const conversation = useConversationStore().conversations.find(x => x.targetId == msg.senderId);
|
||||
|
||||
@@ -178,7 +178,7 @@ input.value = ''; // 清空输入框
|
||||
updateMsg.isError = true;
|
||||
}finally{
|
||||
updateMsg.isLoading = false;
|
||||
chatStore.pushAndSortMessagesAsync([updateMsg], generateSessionId(msg.senderId, msg.receiverId), true);
|
||||
chatStore.pushAndSortMessagesAsync([updateMsg], generateSessionId(msg.senderId, msg.receiverId, msg.chatType == MESSAGE_TYPE.GROUP), true);
|
||||
|
||||
msg.isLoading = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user