diff --git a/src/backend/src/sockets.rs b/src/backend/src/sockets.rs index 0c204116..0264b748 100644 --- a/src/backend/src/sockets.rs +++ b/src/backend/src/sockets.rs @@ -281,6 +281,7 @@ async fn browser_handler( } } +#[allow(clippy::too_many_lines)] pub async fn socket_handler(socket: warp::ws::WebSocket) { let (mut socket_send, mut socket_recv) = socket.split(); let (data_send, mut data_recv) = mpsc::channel(1); diff --git a/src/frontend/src/App.svelte b/src/frontend/src/App.svelte index 18436d2d..722ccdb8 100755 --- a/src/frontend/src/App.svelte +++ b/src/frontend/src/App.svelte @@ -105,12 +105,16 @@ update = socketData.update; login = socketData.login; // Get token - if (localStorage.getItem("token") != null) { - token = localStorage.getItem("token"); - pollServer(window.location.pathname); + if (login) { + if (localStorage.getItem("token") != null) { + token = localStorage.getItem("token"); + pollServer(window.location.pathname); + } else { + // Or login + loginDialog = true; + } } else { - // Or login - loginDialog = true; + pollServer(window.location.pathname); } } if (socketData.error == true) { @@ -151,7 +155,7 @@ token, }); } else { - JSON.stringify({ + json = JSON.stringify({ page, }); } @@ -168,7 +172,6 @@ } function getToken() { - console.log("Getting token..."); const options = { method: "POST", body: password,