class CommentForm { constructor(domain, post) { this.domain = domain; this.post = post; this.form_element = document.getElementById("comment-form"); this.form_element.addEventListener("submit", this.submit); } async submit(event) { const form = new FormData(event.target); form.append("domain", window.location.hostname); try { const response = await fetch(`https://${this.domain}/${this.post}/comments`, { method: "POST", headers: { "Content-Type": "application/json", }, body: form }); const body = response.body; } catch(error) {} } }