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:
parent
b4c234d051
commit
d4437d421f
|
|
@ -5,8 +5,8 @@ import { Button } from "@/components/ui/button"
|
||||||
import { Input } from "@/components/ui/input"
|
import { Input } from "@/components/ui/input"
|
||||||
import { Sprout } from "lucide-react"
|
import { Sprout } from "lucide-react"
|
||||||
|
|
||||||
const LISTMONK_URL = "https://newsletter.jeffemmett.com"
|
const NEWSLETTER_API = "https://newsletter.jeffemmett.com/api/subscribe"
|
||||||
const LIST_UUID = "d076325f-f39a-44a2-874d-2026c7eb6d1c" // MycoFi list
|
const LIST_UUID = "47c050ec-78b4-4f1b-b1d4-708664479685" // MycoFi list
|
||||||
|
|
||||||
export function NewsletterSignup() {
|
export function NewsletterSignup() {
|
||||||
const [email, setEmail] = useState("")
|
const [email, setEmail] = useState("")
|
||||||
|
|
@ -21,21 +21,20 @@ export function NewsletterSignup() {
|
||||||
setStatus("loading")
|
setStatus("loading")
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${LISTMONK_URL}/api/public/subscription`, {
|
const response = await fetch(`${NEWSLETTER_API}/subscribe`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
email: email,
|
email: email,
|
||||||
list_uuids: [LIST_UUID],
|
list_uuid: LIST_UUID,
|
||||||
name: "",
|
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
setStatus("success")
|
setStatus("success")
|
||||||
setMessage("Merge in to the mesh.")
|
setMessage("Merge in to the mesh. The mycelium remembers.")
|
||||||
setEmail("")
|
setEmail("")
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Subscription failed")
|
throw new Error("Subscription failed")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue