Compare commits

..

No commits in common. "274c0b98e3d64741259db4b97a17fcdba600f58e" and "fb68e6d43a94b6b45cee7343790719f9d3dd88c4" have entirely different histories.

2 changed files with 3 additions and 9 deletions

4
.env
View File

@ -1,8 +1,8 @@
# MongoDB connection for backend
CONNECTION_URI=mongodb://admin:adminpassword@192.168.0.197:27018/ludo?authSource=admin&replicaSet=rs0
CONNECTION_URI=mongodb://admin:adminpassword@192.168.0.197:27017/ludo?authSource=admin&replicaSet=rs0
# Backend port
PORT=3000
PORT=8080
# Environment
NODE_ENV=development

View File

@ -13,13 +13,7 @@ function App() {
const [playerSocket, setPlayerSocket] = useState();
const [redirect, setRedirect] = useState();
useEffect(() => {
let socket;
if(process.env.NODE_ENV !== 'production') {
socket = io(`http://${window.location.hostname}:8080`, { withCredentials: true });
} else {
socket = io(`${window.location.protocol}//${window.location.host}`, { withCredentials: true });
}
const socket = io(`http://${window.location.hostname}:8080`, { withCredentials: true });
socket.on('player:data', data => {
data = JSON.parse(data);
setPlayerData(data);