From 8fecf7cb1f86519483f9ec01d7901f4d3372f44e Mon Sep 17 00:00:00 2001 From: Nikolai Petukhov Date: Fri, 11 Oct 2024 13:39:15 +0300 Subject: [PATCH] I have added intervals for messages --- src/pages/Chat.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/Chat.jsx b/src/pages/Chat.jsx index cfbbb29..874ae49 100644 --- a/src/pages/Chat.jsx +++ b/src/pages/Chat.jsx @@ -116,7 +116,12 @@ const Chat = () => { }, []); useEffect(() => { - retrieveMessages().then(); + // retrieveMessages().then(); + const interval = setInterval(() => { + retrieveMessages().then() + }, 2000); + + return () => clearInterval(interval) }, [myId, interlocutorId]); useEffect(() => {