会话切换

dev/chat
Lei OT 2 years ago
parent 2a333c1e45
commit e5469aad5c

@ -86,9 +86,7 @@ export const fetchTemplates = async () => {
export const fetchConversationsList = async (opisn) => {
const { result: data } = await fetchJSON(`${API_HOST}/getconversations`, { opisn });
const _data = [];
// const _data = testConversations;
const list = [..._data, ...data.map((ele) => ({ ...ele, customer_name: ele.whatsapp_name.trim() }))];
const list = data.map((ele) => ({ ...ele, customer_name: ele.whatsapp_name.trim() }));
return list;
};

@ -53,6 +53,9 @@ const Conversations = (() => {
const getCustomerProfile = async (colisn) => {
const data = await fetchCustomerProfile(colisn);
dispatch(receivedCustomerProfile(data));
if (isEmpty(data)) {
return false;
}
if (!isEmpty(data.conversation)) {
dispatch(addConversationList(data.conversations));
dispatch(setCurrentConversation(data.conversation[0]));

Loading…
Cancel
Save