Fixes
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
const login_form = document.getElementById("login-form");
|
||||
const login_button = document.getElementById("login-button");
|
||||
|
||||
login_button.onclick = () => {
|
||||
document.getElementById("login").style.display = "block";
|
||||
};
|
||||
|
||||
login_form.onsubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
const username = login_form.username.value;
|
||||
const pass = login_form.pass.value;
|
||||
let response = await fetch("/login", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ username, pass }),
|
||||
});
|
||||
response = await response.json();
|
||||
document.getElementById("login-info").innerText = response.message;
|
||||
};
|
||||
|
||||
const signup_form = document.getElementById("signup-form");
|
||||
const signup_button = document.getElementById("signup-button");
|
||||
|
||||
signup_button.onclick = () => {
|
||||
document.getElementById("signup").style.display = "block";
|
||||
};
|
||||
|
||||
signup_form.onsubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
const username = signup_form.username.value;
|
||||
const email = signup_form.email.value;
|
||||
const pass = signup_form.pass.value;
|
||||
let response = await fetch("/signup", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ username, email, pass }),
|
||||
});
|
||||
response = await response.json();
|
||||
document.getElementById("signup-info").innerText = response.message;
|
||||
};
|
||||
Reference in New Issue
Block a user