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