Skip to content

Commit

Permalink
fix(frontend): allow not using passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
ravenclaw900 committed Nov 20, 2021
1 parent 6eff076 commit 1607ece
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/backend/src/sockets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 10 additions & 7 deletions src/frontend/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -151,7 +155,7 @@
token,
});
} else {
JSON.stringify({
json = JSON.stringify({
page,
});
}
Expand All @@ -168,7 +172,6 @@
}
function getToken() {
console.log("Getting token...");
const options = {
method: "POST",
body: password,
Expand Down

0 comments on commit 1607ece

Please sign in to comment.