Skip to content

Commit

Permalink
Update ChatPage.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
angelcast2002 committed Oct 11, 2023
1 parent 8c4320e commit a151fd2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions uniEmpleos/src/pages/ChatPage/ChatPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a151fd2

Please sign in to comment.