Use newsletter-api for immediate welcome emails

Switches from direct Listmonk API to newsletter-api endpoint
which handles subscription + sends welcome email immediately.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2025-12-23 01:07:55 -05:00
parent c48fb7cb55
commit 4b966078cc
1 changed files with 6 additions and 7 deletions

View File

@ -2,7 +2,7 @@
import { useState } from "react" 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 const LIST_UUID = "df598d1a-4bed-4a8b-8c36-a5a6346febf0" // Trippin list
export function NewsletterSignup() { export function NewsletterSignup() {
@ -18,21 +18,20 @@ export function NewsletterSignup() {
setStatus("loading") setStatus("loading")
try { try {
const response = await fetch(`${LISTMONK_URL}/subscription/form`, { const response = await fetch(`${NEWSLETTER_API}/subscribe`, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/json",
}, },
body: new URLSearchParams({ body: JSON.stringify({
email: email, email: email,
list: LIST_UUID, list_uuid: LIST_UUID,
name: "",
}), }),
}) })
if (response.ok) { if (response.ok) {
setStatus("success") setStatus("success")
setMessage("Check your email to confirm your subscription!") setMessage("The doors are open. Keep trippin'.")
setEmail("") setEmail("")
} else { } else {
throw new Error("Subscription failed") throw new Error("Subscription failed")