25 lines
767 B
HTML
25 lines
767 B
HTML
{{define "title"}}
|
|
create or join session | {{index . "name"}}
|
|
{{end}}
|
|
|
|
{{define "body"}}
|
|
<button class="button is-primary" id="createSessionBtn">create session</button>
|
|
|
|
<script>
|
|
document.getElementById('createSessionBtn').addEventListener('click', async function() {
|
|
const response = await fetch('/api/session', {
|
|
method: 'GET',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
});
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
}
|
|
|
|
const data = await response.json();
|
|
window.open(`/${data.Name}`);
|
|
});
|
|
</script>
|
|
{{end}} |