diff options
| author | Danilo M. <danix@danix.xyz> | 2026-04-22 12:43:22 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-04-22 12:43:22 +0200 |
| commit | 5b476f8905f411768e23cb01d577a60e5a5fd725 (patch) | |
| tree | 0a08cc83d809dbea714f52826e822501ee7c0165 /themes/danix-xyz-hacker/assets/js/contact-form.js | |
| parent | 082e9246ffe453031894d32d3cee9d5d1bf2b67a (diff) | |
| download | danixxyz-5b476f8905f411768e23cb01d577a60e5a5fd725.tar.gz danixxyz-5b476f8905f411768e23cb01d577a60e5a5fd725.zip | |
chore: extract theme into git submodule (danix2-hugo-theme)
Diffstat (limited to 'themes/danix-xyz-hacker/assets/js/contact-form.js')
| -rw-r--r-- | themes/danix-xyz-hacker/assets/js/contact-form.js | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/themes/danix-xyz-hacker/assets/js/contact-form.js b/themes/danix-xyz-hacker/assets/js/contact-form.js deleted file mode 100644 index 4fa8f55..0000000 --- a/themes/danix-xyz-hacker/assets/js/contact-form.js +++ /dev/null @@ -1,45 +0,0 @@ -document.addEventListener('alpine:init', () => { - Alpine.data('contactForm', () => ({ - formData: { - name: '', - email: '', - message: '' - }, - isSubmitting: false, - statusMessage: '', - statusClass: '', - - async submitContactForm() { - this.isSubmitting = true; - this.statusMessage = ''; - this.statusClass = ''; - - try { - const response = await fetch('/contact.php', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(this.formData) - }); - - const data = await response.json(); - - if (response.ok) { - this.statusMessage = 'Message sent successfully!'; - this.statusClass = 'bg-green-100 text-green-800 border border-green-300'; - this.formData = { name: '', email: '', message: '' }; - } else { - this.statusMessage = data.error || 'An error occurred. Please try again.'; - this.statusClass = 'bg-red-100 text-red-800 border border-red-300'; - } - } catch (error) { - this.statusMessage = 'An error occurred. Please try again.'; - this.statusClass = 'bg-red-100 text-red-800 border border-red-300'; - console.error('Form submission error:', error); - } finally { - this.isSubmitting = false; - } - } - })); -}); |
