Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
justnieto committed Jul 16, 2023
1 parent 74badfa commit 875a0a9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ addEventListener("submit", (event) => {
// 2. empty email
// 3. taken email
// 4. repeat email
let emailTaken = false;
// Loop through to check if already used, if so marks emailTaken true
usersTable.forEach((x) => {
if (x.username === email) {
emailTaken = true;
renderEmailTakenError();
}
});
// If email is empty render empty error
if (!email) {
renderEmailEmptyError();
} else if (!emailTaken) {
// If emailTaken false, add username object to array and render success
usersTable.push({ username: email });
renderSuccess();
}
});

let toggleNav = () => {
Expand Down

0 comments on commit 875a0a9

Please sign in to comment.