1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9430],{79430:(t,n,e)=>{"use strict";e.r(n),e.d(n,{default:()=>f});var a=e(74848),r=e(86715),s=e(96540),l=e(49785),i=e(31983),o=e(72360);async function u(t){let{user:n,password:e}=t,{authEditor:a}=await (0,o.A)("mutation($user: String!, $password: String!) {\n authEditor(user: $user, password: $password) {\n user {\n login\n name\n email\n avatar\n }\n status\n credentials {\n type\n token\n }\n }\n }",{variables:{user:n,password:e}});return a}async function d(t){let{validateEditor:n}=await (0,o.A)("mutation($token: String!) {\n validateEditor(token: $token) {\n user {\n login\n name\n email\n avatar\n }\n status\n credentials {\n type\n token\n }\n }\n }",{variables:{token:t}},!0);return n}var c=e(48940),m=e(72747),p=e(4420),h=e(79783),v=e(68182),b=e.n(v),x=e(77650),g=e(46942),w=e.n(g);function f(t){let{block:n}
1=t,[e,o]=(0,s.useState)(!1),[v,g]=(0,s.useState)(!1),[f,k]=(0,s.useState)(!1),{setPathData:$}=(0,m.Us)(),y=(0,r.useRouter)(),S=(0,l.mN)({mode:"onTouched"}),{isSubmitting:j}=S.formState,{attrs:_}=n;(0,s.useEffect)(()=>{{let t=null,e=null;if((0,c.ET)()&&(t=(0,c.dG)()),window.location.search.length>0){let n=new URLSearchParams(window.location.search);t=n.get("admin-token"),e=n.get("username")}t&&d(t).then(t=>{if("ok"===t.status){var e;if((0,c.gV)(t),null==n?void 0:null===(e=n.attrs)||void 0===e?void 0:e.redirect)return y.push(n.attrs.redirect)}}),e&&S.setValue("user",e),t||o(!0)}return()=>{}},[]);let N=async(t,e)=>{var a,r;let s=await (0,i.U)({path:y.asPath},t);if((null==n?void 0:null===(a=n.attrs)||void 0===a?void 0:a.redirect)&&308===s.status)return y.push(null==n?void 0:null===(r=n.attrs)||void 0===r?void 0:r.redirect),null;200===s.status?$(s):k(!0),"function"==typeof e&&e()},P=async t=>{let{user:e,password:a}=t;v&&g(!1);let r=await u({user:e,password:a});if("ok"===r.status){var s,l;if((0,c.gV)(r),null==n?void 0:null===(s=n.attrs)||void 0===s?void 0:s.redirect)return y.push(n.attrs.redirect);N(null==r?void 0:null===(l=r.credentials)||void 0===l?void 0:l.token)}else g(!0)};return e?(0,a.jsx)(x.A,{block:n,width:"column",children:(0,a.jsxs)("form",{className:"max-w-md mx-auto",onSubmit:S.handleSubmit(P),children:[(0,a.jsx)("input",{autoComplete:"username",className:w()("mb-4",b().input),...S.register("user",{required:!0}),placeholder:_.labelUsername}),(0,a.jsx)("input",{type:"password",autoComplete:"current-password",className:w()("mb-4",b().input),...S.register("password",{required:!0}),placeholder:_.labelPassword}),(0,a.jsx)(h.A,{size:"small",theme:"good-blue",ariaLabel:_.labelLogin,disable:j,type:"submit",className:"w-full",children:j?"H\xe4mtar...":_.labelLogin}),v&&(0,a.jsx)("p",{className:"mt-4 text-sm text-center text-red-100",children:"Fel anv\xe4ndarnamn/l\xf6senord, v\xe4nligen f\xf6rs\xf6k igen."}),f&&(0,a.jsx)("p",{className:"mt-4 text-sm text-center text-red-100",children:"Ett fel uppstod, v\xe4nligen f\xf6rs\xf6k igen."})]})}):(0,a.jsx)("div",{className:"p-16 pb-20 text-center",children:(0,a.jsx)(p.y,{size:"large",borderClass:"border-good-blue-100",spinColor:"#e2e2e2",className:"mx-auto"})})}},31983:(t,n,e)=>{"use strict";e.d(n,{U:()=>r});var a=e(72360);async function r(t,n){let{path:e,isPreview:r,password:s,id:l,locale:i}=t,o=JSON.stringify({context:"bra-miljoval",locale:i});return e=r?null:"/bra-miljoval"+e,r||(e=e.startsWith("/bra-miljoval/")?e:"/bra-miljoval"+e),(await (0,a.A)("\n query ($path: String, $context: String, $isPreview: Boolean, $password: String, $id: Int) {\n fetchPathData(path: $path, context: $context, isPreview: $isPreview, password: $password, id: $id) {\n template\n path\n status\n redirect\n head {\n tag\n attrs\n }\n menus {\n location\n items {\n url\n target\n label\n items {\n url\n target\n label\n items {\n url\n target\n label\n }\n }\n }\n }\n copy {\n location\n strings\n }\n meta\n props {\n location\n content\n }\n content {\n name\n text\n html\n attrs\n innerBlocks {\n name\n text\n html\n attrs\n innerBlocks {\n name\n text\n html\n attrs\n innerBlocks {\n name\n text\n html\n attrs\n innerBlocks {\n name\n text\n html\n attrs\n }\n }\n }\n }\n }\n }\n }",{variables:{path:e,context:o,isPreview:r,password:s,id:l}},n?{Authorization:"Bearer ".concat(n)}:null)).fetchPathData}},68182:t=>{t.exports={input:"input_input__HPZtR",textarea:"input_textarea__1Xopk",disabled:"input_disabled__Erfav"}}}]); 2//# sourceMappingURL=9430.79bcbe1fd0818f25.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.