fix: ConversationsList navigate replace

dev/chat
Lei OT 2 years ago
parent 9d00a0f436
commit e19907f4c7

@ -11,7 +11,8 @@ import useAuthStore from '@/stores/AuthStore';
* []
*/
const Conversations = ({ mobile }) => {
const routerReplace = mobile === undefined ? false : true;
const routerReplace = mobile === undefined ? true : false; // : true;
const routePrefix = mobile === undefined ? `/order/chat` : `/m/chat`;
const { state: orderRow } = useLocation();
const { coli_guest_WhatsApp } = orderRow || {};
const { order_sn } = useParams();
@ -80,13 +81,12 @@ const Conversations = ({ mobile }) => {
const onSwitchConversation = async (item) => {
setCurrentConversation(item);
const routePrefix = mobile === undefined ? `/order/chat` : `/m/chat`;
if (isEmpty(item.coli_sn)) {
navigate(routePrefix, { replace: true });
} else {
setSwitchToC(item);
setShouldFetchCList(false);
navigate(`${routePrefix}/${item.coli_sn}`, { replace: routePrefix });
navigate(`${routePrefix}/${item.coli_sn}`, { replace: routerReplace });
}
// if (!isEmpty(item.coli_sn)) {
// setSwitchToC(item);
@ -102,7 +102,7 @@ const Conversations = ({ mobile }) => {
await fetchConversationItemClose({ conversationid: item.sn, opisn: item.opi_sn });
delConversationitem(item);
if (String(order_sn) === String(item.coli_sn)) {
navigate(`/order/chat`, { replace: routerReplace });
navigate(routePrefix, { replace: routerReplace });
}
};

Loading…
Cancel
Save