diff --git a/assets/js/src/contact.js b/assets/js/src/contact.js index 80f2e904..a03d40de 100644 --- a/assets/js/src/contact.js +++ b/assets/js/src/contact.js @@ -1,89 +1,142 @@ import "vanilla-hcaptcha"; +import { h, render } from "preact"; +import { useState } from "preact/hooks"; import fetch from "unfetch"; -// don't continue if there isn't a contact form on this page -// TODO: be better and only do any of this on /contact/ -const contactForm = document.querySelector("form#contact-form"); +const CONTACT_ENDPOINT = "/api/contact/"; -if (contactForm) { - contactForm.addEventListener("submit", (event) => { - // immediately prevent