document.getElementById("send").addEventListener("submit", async e => {
e.preventDefault();
const form = e.target;
const data = new FormData(form);
fetch("/api/messages", {
method: 'POST',
body: JSON.stringify({ threadID: data.get("threadID"), content: data.get("content") }),
headers: {
"Content-Type": "application/json"
}
}).then(res => res.json())
.then(res => {
if (res.result.error) return alert(res.result.error);
form.reset();
const message = res.result;
document.getElementById("messages").innerHTML += `