-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup.js
More file actions
31 lines (31 loc) · 1.03 KB
/
Copy pathsignup.js
File metadata and controls
31 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const email = document.getElementById("email");
const password = document.getElementById("password");
const password_check = document.getElementById("confirm-password");
const sub_button = document.getElementById("submit");
// let allLogin;
// fetch("login.json")
// .then((response) => response.json())
// .then((products) => {
// allLogin = products; // Store the fetched products for search // Display all products initially
// });
sub_button.addEventListener("click", () => {
// const q = allLogin.find((p) => {
// p.email == email.value;
// });
if (password.value == password_check.value) {
fetch(`http://127.0.0.1:3000/signup?+${email.value}+${password.value}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
})
.then((response) => {
if (response.ok) {
window.location.href = "/";
}
})
.catch((error) => console.error("Error:", error));
} else {
alert("the passords doesn't match");
}
});