From e8f3acd73e6db2c4ffda7f50a147d6c54944496e Mon Sep 17 00:00:00 2001 From: ShadowCat567 Date: Tue, 23 Apr 2024 19:03:13 -0400 Subject: [PATCH] D:/Git/chatpage is in accessible --- back-end/Server.js | 2 +- front-end/src/App.js | 2 +- front-end/src/LoginForm.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/back-end/Server.js b/back-end/Server.js index fa903c0..5b3e871 100644 --- a/back-end/Server.js +++ b/back-end/Server.js @@ -24,8 +24,8 @@ io.use((socket) => { if(!sockUsername) { console.log("No username received"); } - console.log(`Socket username: ${sockUsername}`); socket.username = sockUsername; + console.log(`Socket username: ${socket.username}`); }); io.on('connection', (socket) => { diff --git a/front-end/src/App.js b/front-end/src/App.js index 0aa13e1..8a8ae8a 100644 --- a/front-end/src/App.js +++ b/front-end/src/App.js @@ -21,7 +21,7 @@ function App() { } /> } /> - } /> + } /> } /> } /> } /> diff --git a/front-end/src/LoginForm.js b/front-end/src/LoginForm.js index 1d731be..5d0560c 100644 --- a/front-end/src/LoginForm.js +++ b/front-end/src/LoginForm.js @@ -30,7 +30,7 @@ function LoginForm() { console.log('Login successful:', data); //connect the chat socket and register its username - socket.auth.username = username; + socket.auth = { username }; socket.connect(); localStorage.setItem('token', data.token); // Save the token to localStorage