From 1a08acdc7c73294e811ca034ea55f1dae13ab550 Mon Sep 17 00:00:00 2001 From: inportb Date: Mon, 26 Sep 2022 17:38:27 -0400 Subject: [PATCH] Host switching --- htdocs/App.vue | 10 +++-- htdocs/Login.vue | 110 ++++++++++++++++++++++++++++++++++++---------- htdocs/Navbar.vue | 8 +++- htdocs/vista.mjs | 10 ++++- htdocs/vistax.mjs | 24 +++++++--- main.py | 11 +++++ 6 files changed, 138 insertions(+), 35 deletions(-) diff --git a/htdocs/App.vue b/htdocs/App.vue index 543ae82..355200d 100644 --- a/htdocs/App.vue +++ b/htdocs/App.vue @@ -1,9 +1,9 @@ @@ -26,6 +26,7 @@ data() { return { client: null, + server: null, user: null, heartbeat: null, banner: '', @@ -36,7 +37,7 @@ store: () => store }, watch: { - async client(value) { + async client(value, oldvalue) { if(this.heartbeat) window.clearInterval(this.heartbeat); else { [ @@ -47,7 +48,8 @@ ].forEach(route => this.$root.$router.addRoute(route)); await this.$root.$router.replace(this.$route); } - this.heartbeat = await value.heartbeat(); + if(value) this.heartbeat = await value.heartbeat(); + if(oldvalue) this.$router.go(); // refresh if changed } } }; diff --git a/htdocs/Login.vue b/htdocs/Login.vue index f528335..6b485b2 100644 --- a/htdocs/Login.vue +++ b/htdocs/Login.vue @@ -1,25 +1,60 @@ + +