Skip to content

Commit

Permalink
[frontend] Fix socket url and useEffect dependency array (#77)
Browse files Browse the repository at this point in the history
Fixed url when creating socket instance
Fixed warnings for useEffect dependency array
  • Loading branch information
lim396 authored Nov 22, 2023
1 parent b665b4d commit 87bb67d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/app/ui/room/chat-room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function ChatHome({ id, user }: { id: number; user: User }) {
console.log("disconnect");
socket.disconnect();
};
}, []);
}, [id]);

const sendMessage = (e: React.SyntheticEvent) => {
e.preventDefault();
Expand Down
2 changes: 1 addition & 1 deletion frontend/socket.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { io } from "socket.io-client";
export const socket = io("http://" + `${process.env.NEXT_PUBLIC_WEB_URL}`, {
export const socket = io(`${process.env.NEXT_PUBLIC_WEB_URL}`, {
autoConnect: false,
});

0 comments on commit 87bb67d

Please sign in to comment.