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) => {
|
||||
console.log(serverselect.value);
|
||||
window.location.hash = serverselect.value;
|
||||
server = serverselect.value;
|
||||
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() {
|
||||
|
@ -90,7 +99,15 @@ function main() {
|
|||
return
|
||||
}
|
||||
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) {
|
||||
console.error(`Error: ${err}`);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue