Change all_sessions to buttons
This commit is contained in:
parent
40dd6ea865
commit
dd0490ee13
@ -12,6 +12,17 @@ ws.onmessage = function(event) {
|
||||
}
|
||||
|
||||
if (msg.hasOwnProperty('allsessions')) {
|
||||
document.getElementById('all_sessions').innerText = msg.allsessions.join(', ');
|
||||
const all_sessions = document.getElementById('all_sessions');
|
||||
|
||||
while (all_sessions.children.length) all_sessions.lastChild.remove();
|
||||
|
||||
for (let session of msg.allsessions) {
|
||||
const button = document.createElement('button');
|
||||
button.innerText = session;
|
||||
button.onclick = async (e) => await fetch('api/join_session', {
|
||||
method: 'POST', body: JSON.stringify({sessionid: session})
|
||||
});
|
||||
all_sessions.appendChild(button);
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user