Spaces:
Sleeping
Sleeping
Update templates/signin.html
Browse files- templates/signin.html +3 -8
templates/signin.html
CHANGED
|
@@ -3,24 +3,19 @@
|
|
| 3 |
<script>
|
| 4 |
document.addEventListener(
|
| 5 |
"keydown",
|
| 6 |
-
(event)
|
| 7 |
const keyName = event.key;
|
| 8 |
|
| 9 |
let userInput = document.getElementById("userInput");
|
| 10 |
let passInput = document.getElementById("passInput");
|
| 11 |
|
| 12 |
if (keyName === "Enter") {
|
| 13 |
-
|
| 14 |
method: "POST",
|
| 15 |
header: {"Content-Type": "application/json"},
|
| 16 |
body: JSON.stringify({username: userInput.value, password: passInput.value})
|
| 17 |
})
|
| 18 |
-
|
| 19 |
-
if (!resp.ok) {
|
| 20 |
-
alert("Something went wrong")
|
| 21 |
-
} else {
|
| 22 |
-
alert("All good!")
|
| 23 |
-
}
|
| 24 |
}
|
| 25 |
}
|
| 26 |
)
|
|
|
|
| 3 |
<script>
|
| 4 |
document.addEventListener(
|
| 5 |
"keydown",
|
| 6 |
+
function(event) {
|
| 7 |
const keyName = event.key;
|
| 8 |
|
| 9 |
let userInput = document.getElementById("userInput");
|
| 10 |
let passInput = document.getElementById("passInput");
|
| 11 |
|
| 12 |
if (keyName === "Enter") {
|
| 13 |
+
fetch("/api/signup", {
|
| 14 |
method: "POST",
|
| 15 |
header: {"Content-Type": "application/json"},
|
| 16 |
body: JSON.stringify({username: userInput.value, password: passInput.value})
|
| 17 |
})
|
| 18 |
+
.then(response => response.json())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
}
|
| 21 |
)
|