save username in cookie
This commit is contained in:
parent
539a36dffe
commit
2d98665f92
7 changed files with 149 additions and 95 deletions
|
@ -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");
|
||||
|
|
Reference in a new issue