simplified jqeury code

This commit is contained in:
Rohan Sircar 2020-07-23 12:21:53 +05:30
parent 05ba6fbacc
commit 85a8f41da0

View File

@ -5,17 +5,9 @@ import log from "loglevel";
export async function stats(): Promise<void> {
const stats = await getStats(Credentials.authToken);
$("#totalMessages").each((i, el) => {
el.textContent = stats.totalMessages.toString();
});
$("#totalUsers").each((i, el) => {
el.textContent = stats.totalUsers.toString();
});
$("#totalOnlineUsers").each((i, el) => {
el.textContent = stats.totalOnlineUsers.toString();
});
$("#numMessagesToday").each((i, el) => {
el.textContent = stats.numMessagesToday.toString();
});
$("#totalMessages").text(stats.totalMessages);
$("#totalUsers").text(stats.totalUsers);
$("#totalOnlineUsers").text(stats.totalOnlineUsers);
$("#numMessagesToday").text(stats.numMessagesToday);
log.debug(stats);
}