Commit fea0bdc8 by Sixong.Zhu

event

parent add19259
Showing with 3 additions and 8 deletions
......@@ -42,7 +42,7 @@ function filterMessages(
);
}
const removeRegisterChatEvents: (() => void)[] = [];
let removeRegisterChatEvents: (() => void)[] = [];
async function preCacheImgs(msgs: any[]) {
await Promise.all(
......@@ -541,18 +541,12 @@ export default {
}
state[ChatStore.STATE_FUNC_ON_NEW_MSG](e);
};
if (chatId == null) {
if (!chatId) {
xim.off("msg", onNewMsg);
xim.on("msg", onNewMsg);
return;
}
const onMsgRead: ChatNotifyListener = async (e) => {
if (
process.env.VUE_APP_API_CLIENT_ID !==
"teamix-fast-service-merchant"
) {
return;
}
if (chatId !== e.chat_id) return;
const msgs = state[ChatStore.STATE_CHAT_MSG_HISTORY];
if (msgs == null) return;
......@@ -655,6 +649,7 @@ export default {
commit(ChatStore.MUTATION_INITING_CHAT);
removeRegisterChatEvents.forEach((k) => k());
removeRegisterChatEvents = [];
await dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS);
await Promise.all([
dispatch(ChatStore.ACTION_REGISTER_EVENT),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment