save username in cookie

This commit is contained in:
Florian Hoss 2022-04-04 11:40:34 +02:00
parent 539a36dffe
commit 2d98665f92
7 changed files with 149 additions and 95 deletions

View file

@ -15,14 +15,14 @@
<a class="link-secondary" href="/login">Login instead</a>
</div>
{{template "scripts" .}}
{{template "formScripts" .}}
<script>
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);
console.log(json);
redirect("/");
} else {
redirect("/register");