PageSourceSearch

https://getautomate.io/assets/unsubscribe-DHhL1rCh.js

js getautomate.io collected 2026-10-01 23:44:06 UTC 2,125 bytes, 1 lines download raw bytes

1import{n as l,r as o,j as e}from"./index-BEZaEVW0.js";function m(){const{token:i}=l({from:"/unsubscribe"}),[n,r]=o.useState("loading"),[c,a]=o.useState("");o.useEffect(()=>{if(!i){r("invalid");return}(async()=>{try{const t=await fetch(`/email/unsubscribe?token=${encodeURIComponent(i)}`),s=await t.json();t.ok?s.valid===!1&&s.reason==="already_unsubscribed"?r("already"):s.valid?r("ready"):r("invalid"):(r("invalid"),a(s.error||"Invalid link"))}catch{r("error")}})()},[i]);async function d(){r("submitting");try{const t=await fetch("/email/unsubscribe",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({token:i})}),s=await t.json();t.ok&&(s.success||s.reason==="already_unsubscribed")?r("done"):(r("error"),a(s.error||"Failed to unsubscribe"))}catch{r("error")}}return e.jsx("main",{className:"min-h-[70vh] flex items-center justify-center px-6 py-16",children:e.jsxs("div",{className:"max-w-md w-full bg-card border border-border rounded-2xl p-8 text-center",children:[e.jsx("h1",{className:"text-2xl font-bold mb-3",children:"Unsubscribe"}),n==="loading"&&e.jsx("p",{className:"text-muted-foreground",children:"Checking your link…"}),n==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground mb-6",children:"Click below to stop receiving emails from Automate."}),e.jsx("button",{onClick:d,className:"inline-flex items-center justify-center rounded-lg bg-primary text-primary-foreground px-5 py-3 font-semibold hover:opacity-90",children:"Confirm unsubscribe"})]}),n==="submitting"&&e.jsx("p",{className:"text-muted-foreground",children:"Processing…"}),n==="done"&&e.jsx("p",{className:"text-muted-foreground",children:"You're unsubscribed. You won't receive further emails from us."}),n==="already"&&e.jsx("p",{className:"text-muted-foreground",children:"You're already unsubscribed."}),n==="invalid"&&e.jsxs("p",{className:"text-muted-foreground",children:["This unsubscribe link is invalid or has expired. ",c]}),n==="error"&&e.jsx("p",{className:"text-muted-foreground",children:"Something went wrong. Please try again later."})]})})}export{m as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.