Skip to content

Commit

Permalink
Update 11-subscribe.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorSvertoka committed Jan 22, 2024
1 parent e9e6a4b commit c845099
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/js/11-subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Messages } from './13-messages.js';
const form = document.getElementById('subscribeForm');
const emailInput = form.querySelector('input[name="email"]');
const subscribeBtn = document.getElementById('subscribeBtn');
// console.dir(subscribeBtn);

emailInput.addEventListener('input', handleEmailValidation);
form.addEventListener('submit', subscribe);
Expand All @@ -20,7 +19,7 @@ function handleEmailValidation() {
const emailValue = emailInput.value;
const isValid = isValidEmail(emailValue);

// emailInput.style.borderColor = isValid ? 'green' : 'red';
emailInput.style.borderColor = isValid ? 'green' : 'red';
}

async function subscribe(e) {
Expand All @@ -47,7 +46,7 @@ async function subscribe(e) {
);
if (response.status >= 200 && response.status < 300) {
form.reset();
// emailInput.style.borderColor = '';
emailInput.style.borderColor = '';
return Messages.success(`${response.data.message}`);
} else {
console.error('Server Error:', response.status, response.statusText);
Expand Down

0 comments on commit c845099

Please sign in to comment.