text: const newFormHandler = async (event) => {
      event.preventDefault();
  
      const title = document.querySelector("#blog-title").value.trim();
      const description = document.querySelector("#blog-desc").value.trim();
  
      if (title && description) {
          const response = await fetch(`/api/blogs`, {
              method: "POST",
              body: JSON.stringify({ title, description }),
              headers: {
                  "Content-Type": "application/json",
              },
          });
  
          if (response.ok) {
              document.location.replace("/profile");
          } else {
              response.json(err);
              alert("Failed to create blog post.")
          }
      }
  };
  
  const delButtonHandler = async (event) => {
      if (event.target.hasAttribute("data-id")) {
          const id = event.target.getAttribute("data-id");
  
          const response = await fetch(`/api/blogs/${id}`, {
              method: "DELETE",
          });
  
          if (response.ok) {
              document.location.replace("/profile");
          } else {
              alert("Failed to delete blog post");
          }
      }
  };
  
  document
      .querySelector(".new-blog-form")
      .addEventListener("submit", newFormHandler);
  
  document
      .querySelector(".blog-list")
      .addEventListener("click", delButtonHandler);