1 line
6.2 KiB
JavaScript
1 line
6.2 KiB
JavaScript
|
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5114],{97037:function(e,a,s){s.d(a,{Z:function(){return t}});var l=s(85893);s(67294);function t(e){var a=e.message;return(0,l.jsxs)("div",{className:"p-2 bg-orange-50 w-full justify-center rounded text-sm text-orange-700 border border-orange-400 border-solid",children:[(0,l.jsx)("img",{src:"/images/warning.png",alt:"Warning Image Icon",width:22,className:"-my-2"}),(0,l.jsx)("span",{children:a})]})}},65114:function(e,a,s){s.d(a,{Z:function(){return p}});var l=s(828),t=s(85893),n=s(67294),r=s(86729),i=s(47568),o=s(97582);function d(){return(d=(0,i.Z)((function(e){var a,s,l,t,n,i,d;return(0,o.__generator)(this,(function(o){return a=e.e,s=e.setLoading,l=e.user,t=e.image,n=e.query,s(!0),i={first_name:a.target.first_name.value,last_name:a.target.last_name.value,email:l?null:a.target.email_address.value,username:l?null:a.target.username.value,password:l?null:a.target.password.value,image:t||null},(null===n||void 0===n?void 0:n.invite)&&(i.inviteObject=n),d=l?"/api/updateUser":"/api/registerUser",(0,r.Z)(d,{method:"post",body:i},!!l).then((function(e){console.log(e),!l&&(null===e||void 0===e?void 0:e.insertId)?(localStorage.setItem("id",e.insertId),(0,r.Z)("/api/loginUser",{method:"post",body:{email:i.email,password:i.password}}).then((function(e){console.log(e),localStorage.setItem("csrf",e.user.csrf_k),localStorage.setItem("stripe_id",e.user.stripe_id),localStorage.setItem("user",JSON.stringify(e.userPayload)),window.location.href="/admin"}))):l&&(null===e||void 0===e?void 0:e.user)?window.location.reload():(null===e||void 0===e?void 0:e.msg)&&alert(e.msg)})).catch((function(e){console.log(e)})).finally((function(){setTimeout((function(){s(!1)}),2e3)})),[2]}))}))).apply(this,arguments)}var u,c=s(97037),m=s(95264),f=s(98374);function p(e){var a=e.user,s=e.query,i=e.image,o=(null===s||void 0===s?void 0:s.email)?s.email:(null===a||void 0===a?void 0:a.email)?a.email:"",p=(0,l.Z)(n.useState(null),2),g=p[0],v=p[1],x=(0,l.Z)(n.useState(!1),2),h=x[0],w=x[1];return(0,t.jsxs)("div",{className:"relative w-full max-w-2xl flex-col items-start",children:[h&&(0,t.jsx)(m.Z,{}),!a&&(0,t.jsxs)(n.Fragment,{children:[(0,t.jsx)("hr",{className:"opacity-0"}),(0,t.jsx)(f.Z,{user:null,userType:"admin",setLoading:w}),(0,t.jsxs)("div",{className:"w-full justify-center relative",children:[(0,t.jsx)("span",{className:"bg-white dark:bg-slate-800 px-3 relative z-10",children:"OR"}),(0,t.jsx)("hr",{className:"absolute"})]})]}),(0,t.jsxs)("form",{className:"w-full flex flex-col items-start gap-4 relative",onSubmit:function(e){e.preventDefault(),function(e){d.apply(this,arguments)}({e:e,setLoading:w,user:a,image:i,query:s})},children:[g&&(0,t.jsx)(c.Z,{message:g}),(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",children:[(0,t.jsx)("label",{htmlFor:"first_name",children:"First Name"}),(0,t.jsx)("input",{type:"text",name:"first_name",id:"first_name",placeholder:"First Name",autoComplete:"given-name",onInput:function(e){var a=e.target;a.value.match(/./)?(a.classList.remove("warning"),v(null)):a.classList.add("warning")},defaultValue:a?a.first_name:"",required:!0})]}),(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",children:[(0,t.jsx)("label",{htmlFor:"last_name",children:"Last Name"}),(0,t.jsx)("input",{type:"text",name:"last_name",id:"last_name",placeholder:"Last Name",autoComplete:"family-name",onInput:function(e){var a=e.target;a.value.match(/./)?(a.classList.remove("warning"),v(null)):a.classList.add("warning")},defaultValue:a?a.last_name:"",required:!0})]}),(0,t.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",children:[(0,t.jsx)("label",{htmlFor:"username",children:"Username"}),(0,t.jsx)("input",{type:"text",name:"username",id:"username",placeholder:"Username",autoComplete:"username",onInput:function(e){var a=e.target;a.value.match(/./)?(a.classList.remove("warning"),v(null)):a.classList.add("warning"),window.clearTimeout(u),u=setTimeout((function(){(0,r.Z)("/api/checkDuplicateData?type=username&value=".concat(a.value,"&tabl
|