1import{r as s,v as w,j as e,w as A,x as k,G as E,L as N,A as F}from"./index-CRtHL2ss.js";import{a as I}from"./index-42ANG6Sg.js";import{u as R,F as r,B as P}from"./use-toast-KGOY00hK.js";import{C as q,B,V as h}from"./v-stack-Byd_NaQC.js";import{H as U}from"./heading-DjEPjSP5.js";import{F as o}from"./form-label-m-sTKBG-.js";import{I as i}from"./input-qdaEkEf3.js";import{T as V}from"./text-BLM1BKBN.js";const J=()=>{const[l,g]=s.useState(""),[c,f]=s.useState(""),[u,j]=s.useState(""),[d,y]=s.useState(""),[S,m]=s.useState(!1),[v,L]=s.useState(!1),C=w(),n=R(),b=t=>{p(null,t.credential)},p=async(t,x)=>{t?.preventDefault(),m(!0);try{const a=await I.post(`${F}/api/signup`,{email:l,password:c,firstName:u,lastName:d,credential:x});a.data.token&&(x?(localStorage.setItem("token",a.data.token),n({title:"Account created.",description:"Successfully signed up with Google.",status:"success",duration:3e3,isClosable:!0}),C("/mytrips")):(L(!0),n({title:"Verification email sent",description:"Please check your email to verify your account.",status:"info",duration:5e3,isClosable:!0})))}catch(a){n({title:"An error occurred.",description:a.response?.data?.message||"Unable to create account.",status:"error",duration:3e3,isClosable:!0})}finally{m(!1)}};return e.jsx(q,{maxW:"container.sm",py:8,children:e.jsx(B,{children:e.jsxs(h,{spacing:6,align:"stretch",children:[e.jsx(U,{as:"h1",size:"xl",textAlign:"center",children:"Sign Up"}),v&&e.jsxs(A,{status:"success",children:[e.jsx(k,{}),"Please check your email to verify your account"]}),e.jsx("form",{onSubmit:p,children:e.jsxs(h,{spacing:4,children:[e.jsxs(r,{isRequired:!0,children:[e.jsx(o,{children:"Email"}),e.jsx(i,{type:"email",value:l,onChange:t=>g(t.target.value),placeholder:"Enter your email"})]}),e.jsxs(r,{isRequired:!0,children:[e.jsx(o,{children:"Password"}),e.jsx(i,{type:"password",value:c,onChange:t=>f(t.target.value),placeholder:"Create a password",minLength:8})]}),e.jsxs(r,{isRequired:!0,children:[e.jsx(o,{children:"First Name"}),e.jsx(i,{type:"text",value:u,onChange:t=>j(t.target.value),placeholder:"Enter your first name"})]}),e.jsxs(r,{isRequired:!0,children:[e.jsx(o,{children:"Last Name"}),e.jsx(i,{type:"text",value:d,onChange:t=>y(t.target.value),placeholder:"Enter your last name"})]}),e.jsx(P,{type:"submit",colorScheme:"blue",width:"full",isLoading:S,size:"lg",children:"Sign Up"}),e.jsx(E,{size:"large",onSuccess:b})]})}),e.jsxs(V,{textAlign:"center",children:["Already have an account?"," ",e.jsx(N,{to:"/login",style:{color:"blue"},children:"Log in"})]})]})})})};export{J as default}; 2//# sourceMappingURL=Signup-Covgdmi8.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.