Add Createsession, joinsession to ui
This commit is contained in:
parent
db3d21a1fe
commit
43a2a40207
21
ui.html
21
ui.html
@ -9,14 +9,27 @@
|
||||
<body>
|
||||
this is the UI
|
||||
|
||||
<button id="test_api">Test API</button>
|
||||
<!--<button id="test_api">Test API</button>-->
|
||||
<button id="btn_create_session">Create session</button>
|
||||
<br><br><br>
|
||||
<input id="join_session_id" type="text" placeholder="Enter session id" />
|
||||
<button id="btn_join_session">Create session</button>
|
||||
|
||||
<script src="/static/renderer.js"></script>
|
||||
<script>
|
||||
document.getElementById("test_api").onclick = async function (e) {
|
||||
let data = {foo: 'bar'};
|
||||
document.getElementById("btn_create_session").onclick = async function (e) {
|
||||
let data = {};
|
||||
|
||||
await fetch('api', {
|
||||
await fetch('api/create_session', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
};
|
||||
document.getElementById("btn_join_session").onclick = async function (e) {
|
||||
let text = document.getElementById("join_session_id").text
|
||||
let data = {"sessionid": text};
|
||||
|
||||
await fetch('api/join_session', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user