diff --git a/frontend/js/chat.js b/frontend/js/chat.js index 7acf787..d7aca3c 100644 --- a/frontend/js/chat.js +++ b/frontend/js/chat.js @@ -7,7 +7,7 @@ const logoutButton = document.getElementById('logout'); let currentRecipient = null; -window.onload = function() { +window.onload = () => { document.getElementById('recipient').focus(); } @@ -32,6 +32,7 @@ async function getToken() { const response = await fetch('/auth/token'); if (!response.ok) { console.log('Network response was not ok'); + return null; } return await response.text(); } catch (error) { diff --git a/frontend/js/login.js b/frontend/js/login.js index d4d128e..2ec34bc 100644 --- a/frontend/js/login.js +++ b/frontend/js/login.js @@ -1,3 +1,7 @@ +window.onload = () => { + document.getElementById('username').focus(); +} + function showPasswd() { let x = document.getElementById("password"); if(x.type == "password"){ diff --git a/frontend/js/signup.js b/frontend/js/signup.js index 5c5993c..50f0b80 100644 --- a/frontend/js/signup.js +++ b/frontend/js/signup.js @@ -1,3 +1,7 @@ +window.onload = () => { + document.getElementById('username').focus(); +} + function showPasswd() { let x = document.getElementById("password"); let y = document.getElementById("sPassword"); diff --git a/frontend/routes/chat.html b/frontend/routes/chat.html index 71ad59b..526179b 100644 --- a/frontend/routes/chat.html +++ b/frontend/routes/chat.html @@ -3,20 +3,7 @@