1import{r as p,s as h,U as m,an as u,j as a,a1 as d,ai as f,aj as g,p as x,ao as w,Z as c,al as j,ak as r}from"./index-Dh_AV2g5.js";import{R as y}from"./RootLayout-BvMvLZoB.js";import{B as I}from"./ButtonDebounce-ybBnQvU0.js";import{A as k}from"./authAPI-BkugxGoU.js";import{I as v,P as b}from"./PasswordFieldNoLabel-DuZ1fbiX.js";import"./next-head-BhqH8WkB.js";function B(){let[t,n]=p.useState({phone:"",password:""});p.useEffect(()=>{h.getToken().then(e=>{e&&(location.href=m.home)}),h.getItem("randomKey").then(e=>{if(e){e=u(e);try{let s=JSON.parse(e);n({phone:s.phone,password:s.password})}catch{}}})},[]);async function i(){let e=(document.getElementById("user-phone").value||t.phone).replaceAll(".",""),s=document.getElementById("user-password").value||t.password;if(!w(e))return c("Hãy nháºp sá» Äiá»n thoại và máºt khẩu");if(s.length==0)return c("Hãy nháºp sá» Äiá»n thoại và máºt khẩu");let l={phone:e.replace(/\./g,"").toString(),password:s},o=await k.apiLogin(l.phone,l.password);await h.setItem("randomKey",j(JSON.stringify(l))),o.error||(await r.setItem("tokenExpiredAt",new Date().getTime()+o.expiresIn*1e3),await r.setItem("token",o.token),await r.setItem("freshToken",o.freshToken),await r.setItem("shopId",o.shopId),await r.setItem("userId",o.userId),location.href="/")}return a.jsx(y,{children:a.jsxs("div",{id:"signin-page",children:[a.jsxs("div",{className:"brand-header",children:[a.jsx("h1",{children:d.name}),a.jsx("div",{className:"brand-tagline",children:d.tagline})]}),a.jsxs("div",{className:"box",children:[a.jsxs("div",{className:"head-box",children:[a.jsx("h1",{children:"ÄÄng nháºp"}),a.jsxs("form",{children:[a.jsx(v,{id:"user-phone",placeholder:"Sá» Äiá»n thoại",value:g(t.phone),onChange:e=>{console.log("vao day ma ---------------"),n({...t,phone:f(e.target.value)})},name:"email",onKeyPress:e=>{e.charCode===13&&i()},ref:void 0}),a.jsx(b,{id:"user-password",placeholder:"Máºt khẩu "+d.name,value:t.password,onChange:e=>{n({...t,password:e.target.value})},onKeyPress:e=>{e.charCode===13&&i()},ref:void 0})]}),a.jsx("a",{href:"/auth/reset",children:"Quên máºt khẩu?"})]}),a.jsxs("div",{className:"bottom-box",children:[a.jsx("a",{href:"/auth/register",children:"Tạo tà i khoản"}),a.jsx(I,{onTrueClick:()=>{i()},children:"ÄÄng nháºp"})]}),a.jsx("div",{style:{textAlign:"center",marginTop:25},children:a.jsx("a",{style:{color:x.blue},href:"https://www.facebook.com/afadaApp",target:"_blank",children:"Há» trợ"})})]})]})})}export{B 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.