| const messageUser = (offer) => { | const messageUser = (offer) => { | ||||
| const chatItem = chats.find((item) => item.offer._id === offer?._id); | const chatItem = chats.find((item) => item.offer._id === offer?._id); | ||||
| if (chatItem !== undefined) { | if (chatItem !== undefined) { | ||||
| history.push(DIRECT_CHAT_PAGE, { | |||||
| chatId: chatItem._id, | |||||
| }); | |||||
| console.log(chatItem); | |||||
| history.push( | |||||
| replaceInRoute(DIRECT_CHAT_PAGE, { | |||||
| chatId: chatItem._id, | |||||
| }) | |||||
| ); | |||||
| } else { | } else { | ||||
| if (offer?.user?._id !== userId) { | if (offer?.user?._id !== userId) { | ||||
| history.push({ | history.push({ |