(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3751],{90274:(e,s,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/unsubscribe",function(){return l(71949)}])},71949:(e,s,l)=>{"use strict";l.r(s),l.d(s,{__N_SSP:()=>o,default:()=>d});var a=l(74848),t=l(96540),n=l(620),c=l(96411),i=l(23698),r=l(93444),o=!0;function d(e){let{user:s,email:l,productionEnvironment:o,existingAlerts:d}=e,u="Unsubscribe | Datasquirel",h="Unsubscribe from email alerts",x=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("title",{children:u}),(0,a.jsx)("meta",{name:"description",content:h}),(0,a.jsx)(c.A,{pageTitle:u,pageDescription:h,pagePathname:"/unsubscribe"})]}),[m,b]=t.useState(!1);return(0,a.jsx)(t.Fragment,{children:(0,a.jsx)(r.A,{head:x,user:s,productionEnvironment:o,children:(0,a.jsx)("main",{children:(0,a.jsxs)("section",{children:[m&&(0,a.jsx)(n.A,{}),(0,a.jsxs)("div",{className:"flex-col",children:[(0,a.jsx)("h1",{className:"text-2xl",children:"Unsubscribe from Email alerts"}),!l&&(0,a.jsxs)("p",{className:"max-w-md",children:["No email please ",(0,a.jsx)("a",{href:"/login",children:"Login"})," ","to Access Email Subscriptions or click on"," ",(0,a.jsx)("i",{children:'"unsubscribe"'})," from your mail box"]}),l&&(0,a.jsxs)("form",{className:"flex flex-col items-start gap-4",onSubmit:e=>{e.preventDefault(),b(!0);let a=e.target;(0,i.A)("/api/unsubscribe",{method:"post",body:{email:l,alerts:a.alerts_checkbox.checked,userId:(null==s?void 0:s.id)?s.id:null}}).then(e=>{console.log(e),b(!1)})},children:[(0,a.jsx)("span",{className:"bg-slate-100 py-1 px-3 rounded-full",children:l}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("input",{type:"checkbox",name:"alerts_checkbox",id:"alerts_checkbox",defaultChecked:!!d,className:"w-6 h-6"}),(0,a.jsx)("label",{htmlFor:"alerts_checkbox",className:"text-base whitespace-nowrap text-slate-800",children:"Alerts"})]}),(0,a.jsx)("button",{children:"Save Settings"})]})]})]})})})})}}},e=>{var s=s=>e(e.s=s);e.O(0,[636,6593,8792],()=>s(90274)),_N_E=e.O()}]);