prevent duplicate connection

This commit is contained in:
Elijah R 2024-07-10 23:00:03 -04:00
parent d1295bcc2f
commit 39fb90382c

View file

@ -8,6 +8,7 @@ const elements = {
logonWindow: document.getElementById("logonWindow") as HTMLDivElement,
logonForm: document.getElementById("logonForm") as HTMLFormElement,
logonUsername: document.getElementById("logonUsername") as HTMLInputElement,
logonButton: document.getElementById("logonButton") as HTMLButtonElement,
agentSelect: document.getElementById("agentSelect") as HTMLSelectElement,
chatView: document.getElementById("chatView") as HTMLDivElement,
@ -26,7 +27,11 @@ let logonWindow = new MSWindow(elements.logonWindow, {
logonWindow.show();
let loggingIn = false;
elements.logonForm.addEventListener('submit', e => {
if (loggingIn) return;
loggingIn = true;
elements.logonButton.disabled = true;
e.preventDefault();
connectToRoom();
});