retrieving chats

This commit is contained in:
Nikolai Petukhov
2024-10-04 11:21:21 +03:00
parent 073c61977f
commit d1e824ab77
11 changed files with 338 additions and 88 deletions

View File

@@ -74,7 +74,7 @@ const emojis = [
];
const Chat = () => {
const [interlocutorId, setInterlocutorId] = useState(0);
const [interlocutorId, setInterlocutorId] = useState("");
const [messages, setMessages] = useState([]);
const [newMessage, setNewMessage] = useState("");
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
@@ -83,7 +83,8 @@ const Chat = () => {
const navigate = useNavigate();
useEffect(() => {
const id = parseInt(localStorage.getItem("interlocutorId"), 10) || 0;
// const id = parseInt(localStorage.getItem("interlocutorId"), 10) || 0;
const id = localStorage.getItem("interlocutorId")
setInterlocutorId(id);
socket.current = new WebSocket("ws://localhost:8080");