fix bug when switching from non-functional account
This commit is contained in:
parent
20b716ae57
commit
85c42f70d2
2 changed files with 6 additions and 1 deletions
|
@ -112,6 +112,8 @@ class Localuser {
|
||||||
User.clear();
|
User.clear();
|
||||||
}
|
}
|
||||||
async initwebsocket() {
|
async initwebsocket() {
|
||||||
|
if (!this.initialized)
|
||||||
|
return;
|
||||||
let returny = null;
|
let returny = null;
|
||||||
const promise = new Promise((res) => { returny = res; });
|
const promise = new Promise((res) => { returny = res; });
|
||||||
this.ws = new WebSocket(this.serverurls.gateway.toString() + "?encoding=json&v=9" + (DecompressionStream ? "&compress=zlib-stream" : ""));
|
this.ws = new WebSocket(this.serverurls.gateway.toString() + "?encoding=json&v=9" + (DecompressionStream ? "&compress=zlib-stream" : ""));
|
||||||
|
@ -209,6 +211,8 @@ class Localuser {
|
||||||
this.connectionSucceed = 0;
|
this.connectionSucceed = 0;
|
||||||
document.getElementById("load-desc").innerHTML = "Unable to connect to the Spacebar server, retrying in <b>" + Math.round(0.2 + (this.errorBackoff * 2.8)) + "</b> seconds...";
|
document.getElementById("load-desc").innerHTML = "Unable to connect to the Spacebar server, retrying in <b>" + Math.round(0.2 + (this.errorBackoff * 2.8)) + "</b> seconds...";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
if (!this.initialized)
|
||||||
|
return;
|
||||||
document.getElementById("load-desc").textContent = "Retrying...";
|
document.getElementById("load-desc").textContent = "Retrying...";
|
||||||
this.initwebsocket().then(() => {
|
this.initwebsocket().then(() => {
|
||||||
this.loaduser();
|
this.loaduser();
|
||||||
|
|
|
@ -118,6 +118,7 @@ class Localuser{
|
||||||
User.clear();
|
User.clear();
|
||||||
}
|
}
|
||||||
async initwebsocket():Promise<void>{
|
async initwebsocket():Promise<void>{
|
||||||
|
if(!this.initialized) return;
|
||||||
let returny=null
|
let returny=null
|
||||||
const promise=new Promise((res)=>{returny=res});
|
const promise=new Promise((res)=>{returny=res});
|
||||||
this.ws = new WebSocket(this.serverurls.gateway.toString()+"?encoding=json&v=9"+(DecompressionStream?"&compress=zlib-stream":""));
|
this.ws = new WebSocket(this.serverurls.gateway.toString()+"?encoding=json&v=9"+(DecompressionStream?"&compress=zlib-stream":""));
|
||||||
|
@ -220,8 +221,8 @@ class Localuser{
|
||||||
document.getElementById("load-desc").innerHTML="Unable to connect to the Spacebar server, retrying in <b>" + Math.round(0.2 + (this.errorBackoff*2.8)) + "</b> seconds...";
|
document.getElementById("load-desc").innerHTML="Unable to connect to the Spacebar server, retrying in <b>" + Math.round(0.2 + (this.errorBackoff*2.8)) + "</b> seconds...";
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
if(!this.initialized) return;
|
||||||
document.getElementById("load-desc").textContent="Retrying...";
|
document.getElementById("load-desc").textContent="Retrying...";
|
||||||
|
|
||||||
this.initwebsocket().then(() => {
|
this.initwebsocket().then(() => {
|
||||||
this.loaduser();
|
this.loaduser();
|
||||||
this.init();
|
this.init();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue