"use strict";(self.webpackChunkclient=self.webpackChunkclient||[]).push([[2180],{99679:(e,t,s)=>{s.d(t,{A:()=>n});s(65043);var a=s(70579);const n=()=>(0,a.jsx)("div",{class:"w-4 h-4 border-2 border-t-transparent border-white rounded-full animate-spin"})},78091:(e,t,s)=>{s.d(t,{A:()=>a});const a=()=>e=>{const t=document.getElementById(e);t&&(t.classList.add("shake"),t.querySelectorAll("input").forEach((e=>e.style.borderColor="red")),setTimeout((()=>{t.classList.remove("shake"),t.querySelectorAll("input").forEach((e=>e.style.borderColor="#ccc"))}),1e3))}},12180:(e,t,s)=>{s.r(t),s.d(t,{default:()=>m});var a=s(89379),n=(s(96166),s(82806)),l=s(65043),r=s(78091),o=s(66580),i=s(9435),c=s(99679),d=s(70579);document.title="Signup";const m=()=>{const e=(0,o.Zp)(),t=(0,r.A)(),[s,m]=(0,l.useState)({name:"",email:"",password:""}),u=(0,i.A)(),[p,h]=(0,l.useState)(!1);return(0,d.jsxs)("main",{className:"login__main",children:[(0,d.jsx)("img",{src:n,alt:"Logo.png",className:"mb-5"}),(0,d.jsxs)("div",{className:"login__box flex flex-col",id:"loginBox",children:[(0,d.jsx)("h1",{className:"text-center text-[25px] mb-8 mt-4",children:"Sign Up"}),(0,d.jsxs)("form",{onSubmit:async a=>{a.preventDefault();const n=Object.fromEntries(new FormData(a.target));for(let e of Object.keys(n))if(""===n[e]||void 0===n[e]||null===n[e])return void t("loginBox");try{h(!0);const t="https://ezybill.ureshiiweightloss.com/api/v1/user/create",a=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),n=await a.json();if(h(!1),200!==a.status||!n.register)return u(n.err,"error");e("/admin")}catch(l){h(!1),console.log(l)}},children:[(0,d.jsx)("input",{type:"text",name:"name",value:s.name,onChange:e=>m((0,a.A)((0,a.A)({},s),{},{name:e.target.value})),className:"input_style",placeholder:"Enter username"}),(0,d.jsx)("input",{type:"emial",name:"email",value:s.email,onChange:e=>m((0,a.A)((0,a.A)({},s),{},{email:e.target.value})),className:"input_style",placeholder:"Enter login email"}),(0,d.jsx)("input",{type:"password",name:"pass",value:s.password,onChange:e=>m((0,a.A)((0,a.A)({},s),{},{password:e.target.value})),className:"input_style",placeholder:"Enter password"}),(0,d.jsxs)("button",{className:"button_style flex items-center justify-center gap-2",children:[p?(0,d.jsx)(c.A,{}):null,"Sign up"]})]}),(0,d.jsxs)("div",{className:"flex justify-center text-[12px]",children:["All ready have an account?",(0,d.jsx)(o.N_,{to:"/admin",className:"ml-1",children:"Login"})]})]})]})}},96166:()=>{},82806:(e,t,s)=>{e.exports=s.p+"static/media/logo.fad19e63cefd8737e978.png"}}]);
//# sourceMappingURL=2180.7979755f.chunk.js.map