Embed index.html and dedup people
This commit is contained in:
34
src/index.html
Normal file
34
src/index.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<title>Secret Santa</title>
|
||||
|
||||
<h1>Secret Santa</h1>
|
||||
|
||||
<select id="person">
|
||||
<option selected disabled>Who is drawing?</option>
|
||||
__OPTIONS__
|
||||
</select>
|
||||
|
||||
<div id="result"></div>
|
||||
|
||||
<script>
|
||||
document.getElementById("person").addEventListener('change', event => {
|
||||
const options = {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ "person": event.target.value })
|
||||
};
|
||||
|
||||
console.log(options);
|
||||
|
||||
fetch("api", options)
|
||||
.then(response => response.text())
|
||||
.then(text => {
|
||||
document.getElementById("result").textContent = `Your draw: ${text}`;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user