feat: bind length of conversationList to chat count (#116)

This commit is contained in:
balibabu
2024-03-08 19:33:33 +08:00
committed by GitHub
parent bcb58b7e71
commit c7c451bb9f
5 changed files with 33 additions and 43 deletions

View File

@@ -59,20 +59,6 @@ const model: DvaModel<ChatModelState> = {
currentConversation: { ...payload, message: messageList },
};
},
addEmptyConversationToList(state, {}) {
const list = [...state.conversationList];
// if (list.every((x) => x.id !== 'empty')) {
// list.push({
// id: 'empty',
// name: 'New conversation',
// message: [],
// });
// }
return {
...state,
conversationList: list,
};
},
},
effects: {
@@ -100,7 +86,9 @@ const model: DvaModel<ChatModelState> = {
},
*listDialog({ payload }, { call, put }) {
const { data } = yield call(chatService.listDialog, payload);
yield put({ type: 'setDialogList', payload: data.data });
if (data.retcode === 0) {
yield put({ type: 'setDialogList', payload: data.data });
}
},
*listConversation({ payload }, { call, put }) {
const { data } = yield call(chatService.listConversation, payload);