really basic login
This commit is contained in:
parent
177a26a2e9
commit
539a36dffe
6 changed files with 116 additions and 50 deletions
|
@ -18,13 +18,15 @@
|
|||
|
||||
{{template "scripts" .}}
|
||||
<script>
|
||||
function submitForm(formData) {
|
||||
fetch("/register", {method: 'POST', body: formData, redirect: 'follow'})
|
||||
.then(response => response.json())
|
||||
.then(() => {
|
||||
window.location.href = "/";
|
||||
}
|
||||
).catch(error => console.log(error));
|
||||
async function submitForm(formData) {
|
||||
const response = await fetch("/register", {method: 'POST', body: formData, redirect: 'follow'});
|
||||
if (response.ok) {
|
||||
const json = await response.json();
|
||||
console.log("JSON:", json.message);
|
||||
redirect("/");
|
||||
} else {
|
||||
redirect("/register");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
Reference in a new issue