Spaces:
Sleeping
Sleeping
Update templates/signin.html
Browse files- templates/signin.html +8 -13
templates/signin.html
CHANGED
|
@@ -10,22 +10,17 @@
|
|
| 10 |
let passInput = document.getElementById("passInput");
|
| 11 |
|
| 12 |
if (keyName === "Enter") {
|
| 13 |
-
const
|
| 14 |
method: "POST",
|
| 15 |
-
header:
|
| 16 |
body: JSON.stringify({username: userInput.value, password: passInput.value})
|
| 17 |
})
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
} else {
|
| 25 |
-
alert("All good!");
|
| 26 |
-
console.log("All good! Signed up!")
|
| 27 |
-
}
|
| 28 |
-
})
|
| 29 |
}
|
| 30 |
}
|
| 31 |
)
|
|
|
|
| 10 |
let passInput = document.getElementById("passInput");
|
| 11 |
|
| 12 |
if (keyName === "Enter") {
|
| 13 |
+
const resp = await fetch("/api/signup", {
|
| 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 |
)
|