Now with variable usernames
This commit is contained in:
12
ui.html
12
ui.html
@@ -14,6 +14,9 @@
|
||||
<br>
|
||||
<button id="btn_create_session">Create session</button>
|
||||
<br><br><br>
|
||||
<input id="set_username" type="text" placeholder="New username" />
|
||||
<button id="btn_set_username">Set Username</button>
|
||||
<br><br><br>
|
||||
<input id="join_session_id" type="text" placeholder="Enter session id" />
|
||||
<button id="btn_join_session">Join session</button>
|
||||
|
||||
@@ -36,6 +39,15 @@
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
};
|
||||
document.getElementById("btn_set_username").onclick = async function (e) {
|
||||
let text = document.getElementById("set_username").value;
|
||||
let data = {"username": text};
|
||||
|
||||
await fetch('api/change_username', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user