implement no auth

This commit is contained in:
LouisLam
2021-07-31 23:41:24 +08:00
parent 33d7f8645a
commit 6f868c9ec3
3 changed files with 58 additions and 35 deletions

View File

@@ -56,6 +56,11 @@ export default {
this.$router.push("/setup")
});
socket.on("autoLogin", (monitorID, data) => {
this.loggedIn = true;
this.storage().token = "autoLogin"
});
socket.on("monitorList", (data) => {
// Add Helper function
Object.entries(data).forEach(([monitorID, monitor]) => {
@@ -156,8 +161,12 @@ export default {
this.clearData()
}
if (this.storage().token) {
this.loginByToken(this.storage().token)
let token = this.storage().token;
if (token) {
if (token !== "autoLogin") {
this.loginByToken(token)
}
} else {
this.allowLoginDialog = true;
}