Fix. Refactored code to be to standard

This commit is contained in:
eoghan.conlon 2023-08-07 19:14:11 +01:00
parent fb52550ef2
commit 050fd480fb

View file

@ -8,14 +8,16 @@
<body>
<h2>Welcome to Skynet</h2>
<p>
Skynet is a server cluster that the UL Computer Society runs. If you previously had an account and need to activate it
please click <a href="./modify.html">here</a> to set a contact email address for your account. IF you are a new user,
Skynet is a server cluster that the UL Computer Society runs. If you previously had an account and need to activate
it
please click <a href="./modify.html">here</a> to set a contact email address for your account. IF you are a new
user,
please fill in the form below with the email that you use on ul wolves.
</p>
<form id="register">
<label for="mail">Email address</label>
<input type="email" id="mail" name="email" /> <br />
<input type="submit" value="Submit" />
<input type="email" id="mail" name="email"/> <br/>
<input type="submit" value="Submit"/>
</form>
<p id="formStatus"></p>
<footer>
@ -25,7 +27,7 @@
const formEl = document.getElementById('register');
formEl.addEventListener('submit', (listener) => formHandler(listener));
function formHandler(listener){
function formHandler(listener) {
listener.preventDefault();
const formData = new FormData(formEl);
const email = formData.get("email");
@ -35,7 +37,7 @@
body: JSON.stringify(object),
mode: "cors"
}).then(res => {
if(res.status === 200) {
if (res.status === 200) {
document.getElementById('formStatus').innerHTML = "<span style='background-color: green; color: white'>Success</span>";
} else if (res.status === 500) {
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure</span>";