Frontend fixes.
This commit is contained in:
@@ -73,6 +73,7 @@ export function initWebSocket(
|
||||
usersListEl.innerHTML = groups.length
|
||||
? "Online: " + groups.join(", ")
|
||||
: "Online: ?";
|
||||
renderChat(chatEl, inputContainer);
|
||||
break;
|
||||
}
|
||||
case "join_evt": {
|
||||
@@ -85,6 +86,7 @@ export function initWebSocket(
|
||||
);
|
||||
const groups = getGroupedUsers();
|
||||
usersListEl.innerHTML = "Online: " + groups.join(", ");
|
||||
renderChat(chatEl, inputContainer);
|
||||
break;
|
||||
}
|
||||
case "leave_evt": {
|
||||
@@ -98,6 +100,7 @@ export function initWebSocket(
|
||||
removeUser(sid);
|
||||
const groups = getGroupedUsers();
|
||||
usersListEl.innerHTML = "Online: " + groups.join(", ");
|
||||
renderChat(chatEl, inputContainer);
|
||||
break;
|
||||
}
|
||||
case "name_evt": {
|
||||
@@ -112,6 +115,7 @@ export function initWebSocket(
|
||||
);
|
||||
const groups = getGroupedUsers();
|
||||
usersListEl.innerHTML = "Online: " + groups.join(", ");
|
||||
renderChat(chatEl, inputContainer);
|
||||
break;
|
||||
}
|
||||
case "msg_evt": {
|
||||
@@ -148,6 +152,7 @@ export function initWebSocket(
|
||||
notifyDirectReply(username, content);
|
||||
}
|
||||
}
|
||||
renderChat(chatEl, inputContainer);
|
||||
break;
|
||||
}
|
||||
case "msg_ack": {
|
||||
@@ -164,6 +169,7 @@ export function initWebSocket(
|
||||
setReplyTo(sid);
|
||||
}
|
||||
}
|
||||
renderChat(chatEl, inputContainer);
|
||||
break;
|
||||
}
|
||||
case "name_ack": {
|
||||
@@ -173,6 +179,7 @@ export function initWebSocket(
|
||||
`<span class="err">Name change failed: ${new Option(status).innerHTML}</span>`,
|
||||
);
|
||||
}
|
||||
renderChat(chatEl, inputContainer);
|
||||
break;
|
||||
}
|
||||
case "ping": {
|
||||
@@ -182,9 +189,8 @@ export function initWebSocket(
|
||||
}
|
||||
default:
|
||||
console.warn("Unknown packet type:", packet.type);
|
||||
renderChat(chatEl, inputContainer);
|
||||
}
|
||||
|
||||
renderChat(chatEl, inputContainer);
|
||||
};
|
||||
|
||||
socket.onerror = (err) => {
|
||||
|
||||
Reference in New Issue
Block a user