PageSourceSearch

https://nearestone.com/assets/Auth-e3hCRkxU.js

js nearestone.com collected 2026-10-02 01:36:58 UTC 2,609 bytes, 1 lines download raw bytes

1import{u as C,a as N,b as S,c as k,d as P,r,j as e,C as E,B,L as g,I as p,e as I,s as f}from"./index-BBNW_iBz.js";import{s as L}from"./countryRouting-39JifOLM.js";const A=()=>{const a=C(),{country:b}=N(),[u]=S(),o=b||"us",{user:d}=k(),{toast:m}=P(),i=L(u.get("next")||u.get("redirect"),o),[s,y]=r.useState("signin"),[c,j]=r.useState(""),[l,w]=r.useState(""),[h,x]=r.useState(!1);r.useEffect(()=>{d&&a(i,{replace:!0})},[d,a,i]);const v=async n=>{n.preventDefault(),x(!0);try{if(s==="signup"){const{error:t}=await f.auth.signUp({email:c,password:l,options:{emailRedirectTo:`${window.location.origin}/${o}/auth?next=${encodeURIComponent(i)}`}});if(t)throw t;m({title:"Check your inbox",description:"Confirm your email to finish."})}else{const{error:t}=await f.auth.signInWithPassword({email:c,password:l});if(t)throw t;a(i,{replace:!0})}}catch(t){m({title:"Error",description:t.message,variant:"destructive"})}finally{x(!1)}};return e.jsx("div",{className:"min-h-screen bg-dark flex items-center justify-center p-4",children:e.jsxs(E,{className:"w-full max-w-md p-8 bg-card relative",children:[e.jsxs("button",{type:"button",onClick:()=>window.history.length>1?a(-1):a(`/${o}`),className:"absolute left-3 top-3 inline-flex items-center gap-1 text-sm font-semibold text-muted-foreground hover:text-foreground rounded-md px-2 py-1","aria-label":"Go back",children:[e.jsx("span",{"aria-hidden":"true",children:"←"})," Back"]}),e.jsx("div",{className:"flex items-center justify-center mb-6",children:e.jsx(B,{})}),e.jsx("h1",{className:"text-2xl font-black text-center mb-1",children:s==="signin"?"Welcome back":"Join Nearest One"}),e.jsx("p",{className:"text-sm text-muted-foreground text-center mb-6",children:s==="signin"?"Sign in to continue":"Create your account"}),e.jsxs("form",{onSubmit:v,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(g,{htmlFor:"email",children:"Email"}),e.jsx(p,{id:"email",type:"email",required:!0,value:c,onChange:n=>j(n.target.value)})]}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"password",children:"Password"}),e.jsx(p,{id:"password",type:"password",required:!0,minLength:6,value:l,onChange:n=>w(n.target.value)})]}),e.jsx(I,{type:"submit",disabled:h,className:"w-full bg-primary text-primary-foreground hover:bg-primary/90 font-bold",children:h?"Please wait…":s==="signin"?"Sign in":"Create account"})]}),e.jsx("button",{onClick:()=>y(s==="signin"?"signup":"signin"),className:"w-full text-sm text-muted-foreground hover:text-foreground mt-4",children:s==="signin"?"Don't have an account? Sign up":"Already have an account? Sign in"})]})})};export{A as default};

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.