On start or server select open new websocket rather than reloading
This commit is contained in:
parent
5d8ba91865
commit
905cb9412c
|
@ -62,8 +62,17 @@ function main() {
|
||||||
serverselect.addEventListener("click", (event) => {
|
serverselect.addEventListener("click", (event) => {
|
||||||
console.log(serverselect.value);
|
console.log(serverselect.value);
|
||||||
window.location.hash = serverselect.value;
|
window.location.hash = serverselect.value;
|
||||||
|
server = serverselect.value;
|
||||||
socket.close();
|
socket.close();
|
||||||
location.reload();
|
try {
|
||||||
|
socket = new WebSocket(`wss://${host}/server/${server}/logs?token=${token}`);
|
||||||
|
const attachAddon = new AttachAddon(socket);
|
||||||
|
term.loadAddon(attachAddon);
|
||||||
|
} catch(err) {
|
||||||
|
alert("You are not allowed to use this server");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//location.reload();
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onbeforeunload = function() {
|
window.onbeforeunload = function() {
|
||||||
|
@ -90,7 +99,15 @@ function main() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
socket.close();
|
socket.close();
|
||||||
location.reload();
|
try {
|
||||||
|
socket = new WebSocket(`wss://${host}/server/${server}/logs?token=${token}`);
|
||||||
|
const attachAddon = new AttachAddon(socket);
|
||||||
|
term.loadAddon(attachAddon);
|
||||||
|
} catch(err) {
|
||||||
|
alert("You are not allowed to use this server");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//location.reload();
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.error(`Error: ${err}`);
|
console.error(`Error: ${err}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue