Skip to content

Commit

Permalink
🐛 reverted back to the original emailjs init
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosSouza committed Sep 18, 2024
1 parent 761514d commit 35063ef
Showing 1 changed file with 31 additions and 27 deletions.
58 changes: 31 additions & 27 deletions themes/bruno/assets/js/contact-form.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
(function() {
emailjs.init("l3aDxyNn-8gbF6W4Y");
(function () {
emailjs.init("l3aDxyNn-8gbF6W4Y");

const form = document.getElementById('contactForm');
const submitButton = document.getElementById('submitButton');
const thankYouMessage = document.getElementById('thankYouMessage');
const form = document.getElementById("contactForm");
const submitButton = document.getElementById("submitButton");
const thankYouMessage = document.getElementById("thankYouMessage");

form.addEventListener('submit', function(event) {
event.preventDefault();
form.addEventListener("submit", function (event) {
event.preventDefault();

// Disable the submit button and show loading
submitButton.disabled = true;
submitButton.classList.add('loading');
// Disable the submit button and show loading
submitButton.disabled = true;
submitButton.classList.add("loading");

emailjs.sendForm('service_8zgyk4l', 'template_kvshg7o', this)
.then(function() {
console.log('SUCCESS!');
// Hide the form and show the thank you message
form.style.display = 'none';
thankYouMessage.style.display = 'block';
}, function(error) {
console.log('FAILED...', error);
alert('Failed to send the message. Please try again.');
})
.finally(function() {
// Re-enable the submit button and hide loading
submitButton.disabled = false;
submitButton.classList.remove('loading');
});
});
})();
emailjs
.sendForm("service_8zgyk4l", "template_kvshg7o", this)
.then(
function () {
console.log("SUCCESS!");
// Hide the form and show the thank you message
form.style.display = "none";
thankYouMessage.style.display = "block";
},
function (error) {
console.log("FAILED...", error);
alert("Failed to send the message. Please try again.");
},
)
.finally(function () {
// Re-enable the submit button and hide loading
submitButton.disabled = false;
submitButton.classList.remove("loading");
});
});
})();

0 comments on commit 35063ef

Please sign in to comment.