diff --git a/components/newsletter-signup.tsx b/components/newsletter-signup.tsx index d6f9692..42cdbba 100644 --- a/components/newsletter-signup.tsx +++ b/components/newsletter-signup.tsx @@ -2,7 +2,7 @@ import { useState } from "react" -const LISTMONK_URL = "https://newsletter.jeffemmett.com" +const NEWSLETTER_API = "https://newsletter.jeffemmett.com/api/subscribe" const LIST_UUID = "df598d1a-4bed-4a8b-8c36-a5a6346febf0" // Trippin list export function NewsletterSignup() { @@ -18,21 +18,20 @@ export function NewsletterSignup() { setStatus("loading") try { - const response = await fetch(`${LISTMONK_URL}/subscription/form`, { + const response = await fetch(`${NEWSLETTER_API}/subscribe`, { method: "POST", headers: { - "Content-Type": "application/x-www-form-urlencoded", + "Content-Type": "application/json", }, - body: new URLSearchParams({ + body: JSON.stringify({ email: email, - list: LIST_UUID, - name: "", + list_uuid: LIST_UUID, }), }) if (response.ok) { setStatus("success") - setMessage("Check your email to confirm your subscription!") + setMessage("The doors are open. Keep trippin'.") setEmail("") } else { throw new Error("Subscription failed")