ChandimaPrabath commited on
Commit
b0d2969
·
1 Parent(s): a41c870
Files changed (2) hide show
  1. frontend/app/Auth.js +2 -13
  2. frontend/app/layout.js +2 -1
frontend/app/Auth.js CHANGED
@@ -13,25 +13,14 @@ const Auth = ({
13
  setError,
14
  isSignup,
15
  setIsSignup,
 
 
16
  }) => {
17
  const [usernameValid, setUsernameValid] = useState(false);
18
  const [passwordValid, setPasswordValid] = useState(false);
19
  const [passwordsMatch, setPasswordsMatch] = useState(false);
20
  const [showPassword, setShowPassword] = useState(false);
21
  const [showConfirmPassword, setShowConfirmPassword] = useState(false);
22
- const [ws, setWs] = useState(null); // WebSocket connection state
23
-
24
- // Initialize WebSocket
25
- const initializeWebSocket = () => {
26
- const socket = new WebSocket('ws://your-websocket-server-url'); // Replace with actual WebSocket URL
27
- socket.onopen = () => {
28
- console.log('WebSocket connection established');
29
- };
30
- socket.onclose = () => {
31
- console.log('WebSocket connection closed');
32
- };
33
- setWs(socket);
34
- };
35
 
36
  // Handle login and signup requests
37
  const connectAndAuthenticate = (data) => {
 
13
  setError,
14
  isSignup,
15
  setIsSignup,
16
+ ws,
17
+ status
18
  }) => {
19
  const [usernameValid, setUsernameValid] = useState(false);
20
  const [passwordValid, setPasswordValid] = useState(false);
21
  const [passwordsMatch, setPasswordsMatch] = useState(false);
22
  const [showPassword, setShowPassword] = useState(false);
23
  const [showConfirmPassword, setShowConfirmPassword] = useState(false);
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  // Handle login and signup requests
26
  const connectAndAuthenticate = (data) => {
frontend/app/layout.js CHANGED
@@ -129,7 +129,8 @@ function WebSocketLayout({
129
  setError={setError}
130
  isSignup={isSignup}
131
  setIsSignup={setIsSignup}
132
-
 
133
  />
134
  </div>
135
  )}
 
129
  setError={setError}
130
  isSignup={isSignup}
131
  setIsSignup={setIsSignup}
132
+ ws={ws}
133
+ status={status}
134
  />
135
  </div>
136
  )}