webpnp/ui.html
2020-04-17 02:25:12 +02:00

43 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>leafblade Minecraft Server</title>
<meta charset="UTF-8"/>
</head>
<body>
this is the UI
<br>
<span id="current_session">You are not in any session.</span><br>
<span id="all_sessions"></span><br>
<br>
<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">Join session</button>
<script src="/static/renderer.js"></script>
<script>
document.getElementById("btn_create_session").onclick = async function (e) {
let data = {};
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").value;
let data = {"sessionid": text};
await fetch('api/join_session', {
method: 'POST',
body: JSON.stringify(data),
})
};
</script>
</body>
</html>