|
|
@ -56,7 +56,8 @@ export default class GlobalApi { |
|
|
|
console.log("[WS] Websocket servers connected") |
|
|
|
}; |
|
|
|
this.servers_ws.onmessage = (e) => { |
|
|
|
this.update_server(JSON.parse(e.data)["servers"], false); |
|
|
|
const incoming = JSON.parse(e.data); |
|
|
|
this.update_server(incoming["servers"], incoming["state"] === 0); |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
@ -130,23 +131,6 @@ export default class GlobalApi { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async fillServers() { |
|
|
|
this.load_stages.add("servers") |
|
|
|
console.log(`[API] load: servers`); |
|
|
|
return axios.get("/api/stats?filter=servers" + Random.getRndWebAppend()) |
|
|
|
.then(response => response.data['servers']) |
|
|
|
.then(response => { |
|
|
|
this.update_server(response, true); |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
console.log(`[API] cannot request servers, err: ${err}`); |
|
|
|
throw new Error("BLYA SERVERS"); |
|
|
|
}) |
|
|
|
.finally(() => { |
|
|
|
this.load_stages.remove("servers"); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
async load() { |
|
|
|
this.loading = true; |
|
|
|
document.title = `Загрузка - Факты 13`; |
|
|
@ -154,7 +138,6 @@ export default class GlobalApi { |
|
|
|
this.fillThis('statistic'), |
|
|
|
//this.fillThis('uniq'),
|
|
|
|
this.fillThis('donate'), |
|
|
|
this.fillServers(), |
|
|
|
this.vip.getVipPrices(this.load_stages), |
|
|
|
this.vip.getVipStatistic(this.load_stages), |
|
|
|
this.admin.load(this.load_stages), |
|
|
|