This commit is contained in:
2025-06-22 15:47:32 +03:00
parent ccbb317189
commit b3b86ecd9a
18 changed files with 422 additions and 182 deletions
+44
View File
@@ -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;
};