From aa3a3b06a78f5ff541fb133d737f3d60a1c38754 Mon Sep 17 00:00:00 2001 From: inportb Date: Tue, 27 Sep 2022 21:35:26 -0400 Subject: [PATCH] Manual reconnect --- htdocs/Login.vue | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/htdocs/Login.vue b/htdocs/Login.vue index da98085..10ca643 100644 --- a/htdocs/Login.vue +++ b/htdocs/Login.vue @@ -2,8 +2,9 @@

-
-
+
+
+

{{banner.join('\n')}}
{{user.join('\n')}}

@@ -73,6 +74,7 @@ data() { return { show: false, + fail: false, x_client: this.client, x_server: this.server, x_user: this.user, @@ -98,7 +100,7 @@ }, immediate: true }, client(value) { this.x_client = value; }, - x_client(value) { this.$emit('update:client', value); if(!value) this.connect(); }, + x_client(value) { this.$emit('update:client', value); }, server(value) { this.x_server = value; }, x_server(value) { this.$emit('update:server', value); }, user(value) { this.x_user = value; }, @@ -107,19 +109,20 @@ methods: { async connect() { this.logout(); - this.x_client = await (this.host ? vistax.Client.fromCookie(this.secret, this.host) : vistax.Client.fromCookie(this.secret)); - this.banner = await this.x_client.XUS_INTRO_MSG(); - if((await this.x_client.userinfo()).result) try { - var user = await this.x_client.XUS_GET_USER_INFO(); - this.x_user = user[0] ? user : null - } catch(ex) { - this.x_user = null; - } - this.$emit('update:user', this.x_user); - this.show = !this.x_user; - this.$emit('update:server', this.x_server = (await this.x_client.serverinfo()).result); - console.log('Backend secret', this.secret); - console.log(this.banner); + if(this.x_client = await (this.host ? vistax.Client.fromCookie(this.secret, this.host) : vistax.Client.fromCookie(this.secret))) { + this.banner = await this.x_client.XUS_INTRO_MSG(); + if((await this.x_client.userinfo()).result) try { + var user = await this.x_client.XUS_GET_USER_INFO(); + this.x_user = user[0] ? user : null + } catch(ex) { + this.x_user = null; + } + this.$emit('update:user', this.x_user); + this.show = !this.x_user; + this.$emit('update:server', this.x_server = (await this.x_client.serverinfo()).result); + console.log('Backend secret', this.secret); + console.log(this.banner); + } else this.fail = true; }, async login(evt) { if(this.x_client) {