created some structure and a concept
This commit is contained in:
@@ -3,5 +3,23 @@
|
||||
{{end}}
|
||||
|
||||
{{define "body"}}
|
||||
<button class="button is-primary">create session</button>
|
||||
<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}}
|
||||
Reference in New Issue
Block a user