From a151fd2746fd92b5508ce78df96f2eaf4473a452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Castellanos?= <77862762+angelcast2002@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:33:47 -0600 Subject: [PATCH] Update ChatPage.jsx --- uniEmpleos/src/pages/ChatPage/ChatPage.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/uniEmpleos/src/pages/ChatPage/ChatPage.jsx b/uniEmpleos/src/pages/ChatPage/ChatPage.jsx index b40d10e8..65868ee9 100644 --- a/uniEmpleos/src/pages/ChatPage/ChatPage.jsx +++ b/uniEmpleos/src/pages/ChatPage/ChatPage.jsx @@ -38,22 +38,22 @@ const ChatPage = () => { }) } - useEffect(() => { - obtainMessages() - }, [currentChat]) - const obtainMessages = async () => { if (currentChat !== "") { await apiMessages.handleRequest("POST", "/messages/get", { id_emisor: user.id_user, id_receptor: currentChat, }) - if (cambioChats !== apiMessages.data){ + if (cambioChats !== apiMessages.data) { setCambioChats(apiMessages.data) } } } + useEffect(() => { + obtainMessages() + }, [currentChat]) + const scrollDown = () => { chatContainerRef.current.scrollTo({ top: chatContainerRef.current.scrollHeight,