Commit ff7ed205 by panjiangyi

修复ts报错

parent 168aeeff
Showing with 5 additions and 3 deletions
...@@ -288,10 +288,11 @@ export default { ...@@ -288,10 +288,11 @@ export default {
commit, commit,
}) /* ...params: Parameters<ChatStore.ACTION_GET_MY_CHAT_LIST> */ { }) /* ...params: Parameters<ChatStore.ACTION_GET_MY_CHAT_LIST> */ {
const data = await xim.fetchChatList(); const data = await xim.fetchChatList();
if (data == null) return
const chatList = data.args[0]; const chatList = data.args[0];
console.log("testing", chatList); console.log("testing", chatList);
commit(ChatStore.MUTATION_SAVE_CHAT_LIST, { commit(ChatStore.MUTATION_SAVE_CHAT_LIST, {
list: chatList.map((chat) => { list: chatList.map((chat: any) => {
let business_data; let business_data;
if (chat.business_data) { if (chat.business_data) {
business_data = JSON.parse(chat.business_data); business_data = JSON.parse(chat.business_data);
...@@ -408,7 +409,7 @@ export default { ...@@ -408,7 +409,7 @@ export default {
{ state, commit, dispatch }, { state, commit, dispatch },
params: Parameters<ChatStore.ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN>[0] params: Parameters<ChatStore.ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN>[0]
) { ) {
const { id } = await sdk().model(params.modelName).createChat({ const { id } = await sdk().model(params.modelName).createChat({
detailId: +params.selectedListId detailId: +params.selectedListId
}); });
await new Promise(resolve => setTimeout(resolve, 500)); await new Promise(resolve => setTimeout(resolve, 500));
...@@ -557,6 +558,7 @@ export default { ...@@ -557,6 +558,7 @@ export default {
.execute(); .execute();
await dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST); await dispatch(ChatStore.ACTION_GET_MY_CHAT_LIST);
const firstChat = state[ChatStore.STATE_MY_CHAT_ROOM_LIST]?.list[0]; const firstChat = state[ChatStore.STATE_MY_CHAT_ROOM_LIST]?.list[0];
if (firstChat == null) return
const chatInfo = await getChatModelInfo(firstChat.business_data.model_name, firstChat.business_data.obj_id); const chatInfo = await getChatModelInfo(firstChat.business_data.model_name, firstChat.business_data.obj_id);
await dispatch(ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION, { await dispatch(ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION, {
chatId: firstChat.chat_id, chatId: firstChat.chat_id,
...@@ -616,7 +618,7 @@ export default { ...@@ -616,7 +618,7 @@ export default {
}, },
[ChatStore.GETTER_CURRENT_CURRENT_CHAT](state) { [ChatStore.GETTER_CURRENT_CURRENT_CHAT](state) {
const chatId = state[ChatStore.STATE_CHAT_CURRENT_CHAT_ID]; const chatId = state[ChatStore.STATE_CHAT_CURRENT_CHAT_ID];
const chatList = state[ChatStore.STATE_MY_CHAT_ROOM_LIST].list; const chatList = state[ChatStore.STATE_MY_CHAT_ROOM_LIST]?.list ?? [];
return chatList.find(chat => chat.chat_id === chatId); return chatList.find(chat => chat.chat_id === chatId);
}, },
}, },
......
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