1import{r as m,j as t}from"./index-ClpuwTcw.js";import{C as x}from"./checkbox-BpgPBQYT.js";import y,{ToastType as c}from"./toast-BzoC0l2d.js";function p(s){const[n,r]=m.useState({title:"",message:"",type:c.success}),[d,i]=m.useState(!1),l=(e,a)=>({title:e?"Tak":"Desværre",message:e?a?"Du er tilmeldt":"Du er frameldt":"Noget er gået galt, prøv igen senere",type:e?c.success:c.error}),h=async e=>{try{const a=await u(e);r(l(a,e))}catch{r(l(!1,e))}i(!0)},u=async e=>{const a={Enabled:e,Id:`consent-${s.type}`},o=await fetch("/SelfServiceApi/SetConsent",{method:"PUT",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(a)});if(!o.ok)throw new Error;return o.json()};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"consent-item",children:[t.jsx("div",{className:"consent-item__title",children:s.header}),t.jsx("div",{className:"consent-item__checkbox",children:t.jsx(x,{checked:s.isSelected??!1,label:s.checkLabel,id:s.type,name:s.checkLabel,onChange:h})}),t.jsx("div",{className:"consent-item__content rich-text-styling-dark",dangerouslySetInnerHTML:{__html:s.consentText}}),t.jsx("div",{className:"consent-item__separator"})]}),d&&t.jsx(y,{title:n.title,message:n.message,type:n.type,onClose:()=>{i(!1)}})]})}export{p as default}; 2//# sourceMappingURL=consent-item-DNdbW8GF.js.map
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.