diff --git a/frontend/index.html b/frontend/index.html index e48b511..a226a8a 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -8,6 +8,7 @@ +
@@ -17,7 +18,7 @@


-
+
diff --git a/frontend/index.js b/frontend/index.js new file mode 100644 index 0000000..1568a75 --- /dev/null +++ b/frontend/index.js @@ -0,0 +1,26 @@ +async function login() { + // this.preventDefault(); + // get login details + let name = document.getElementById("name").value; + let password = document.getElementById("password").value; + // request login + let response = await fetch("/login", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + name: name, + password: password + }) + }); + // if failed red button + // else switch screen + if (response.status != 200) { + document.getElementById("loginSubmit").classList.add("error"); + } else { + // switch screen + document.getElementById("login").setAttribute("style", "display: none;"); + document.getElementById("mainPage").setAttribute("style", ""); + } +} \ No newline at end of file