Handle ConnectionResetError
This commit is contained in:
@ -93,31 +93,34 @@
|
||||
},
|
||||
watch: {
|
||||
host: {
|
||||
async handler(value) {
|
||||
this.logout();
|
||||
this.x_client = await (value ? vistax.Client.fromCookie(this.secret, value) : 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);
|
||||
handler(value) {
|
||||
this.connect();
|
||||
}, immediate: true
|
||||
},
|
||||
client(value) { this.x_client = value; },
|
||||
x_client(value) { this.$emit('update:client', value); },
|
||||
x_client(value) { this.$emit('update:client', value); if(!value) this.connect(); },
|
||||
server(value) { this.x_server = value; },
|
||||
x_server(value) { this.$emit('update:server', value); },
|
||||
user(value) { this.x_user = value; },
|
||||
x_user(value) { this.$emit('update:user', value); }
|
||||
},
|
||||
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);
|
||||
},
|
||||
async login(evt) {
|
||||
if(this.x_client) {
|
||||
var res = await ((this.accesscode && this.verifycode) ? this.x_client.authenticate(this.accesscode + ';' + this.verifycode) : this.x_client.authenticate());
|
||||
|
Reference in New Issue
Block a user