import{_ as $}from"./SectionLayer.21234a05.js";import{_ as j}from"./RoundedButton.f48696b9.js";import{_ as N,a as C}from"./SectionWrapper.a3888927.js";import{f as B,r as c,g as v,o as g,c as I,b as s,w as a,a as t,h as M,d as u,t as T,i as A,j as x,k as D,l as E}from"./entry.01d4b5f9.js";import{_ as J}from"./SmallPageHeader.bd7eb180.js";const U=["onSubmit"],O={class:"mb-10"},P=t("h2",{class:"text-primary mb-3 text-[1.75rem] font-semibold"}," Connexion ",-1),R={class:"mb-5"},q=t("label",{class:"text-primary-lighter mb-2 block text-[0.75rem]"},"Email",-1),z={class:"mb-5"},F=t("label",{class:"text-primary-lighter mb-2 block text-[0.75rem]"},"Mot de passe",-1),G={class:"flex flex-col items-center justify-center gap-5"},H={class:"flex justify-center"},K={class:"flex justify-center"},L={class:"flex justify-center"},te={__name:"login",setup(Q){const b=B(),d=c(""),i=c(""),n=c(!1),l=c(null),{$api:p,$router:m,$toast:h}=E(),y=()=>{n.value=!0,l.value=null,p.call("post",p.route("auth.login"),{email:d.value,password:i.value}).then(o=>(localStorage.setItem("token",o.access_token),b.initSession().then(e=>{h.success(`Bonjour ${e.firstname} ${e.lastname} ! Vous voilà connecté.`),m.push("/dashboard")}))).catch(o=>{o.response&&o.response.data.error?l.value=o.response.data.error:l.value=o.message}).finally(()=>{n.value=!1,i.value=""})};return(o,e)=>{const k=$,w=v("Message"),f=v("InputText"),_=j,V=C,S=N;return g(),I("div",null,[s(J,{design:"primary",title:"Se connecter à votre espace"}),s(S,{class:"relative bg-white"},{default:a(()=>[s(k,{class:"bg-no-repeat max-[1735px]:hidden",style:{"background-position":"right 0 bottom 0"},background:"/images/ROND + PIN.png"}),s(V,{"mobile-padding":"",class:"max-w-container relative py-20"},{default:a(()=>[t("form",{onSubmit:D(y,["prevent"]),class:"mx-auto max-w-[30rem]"},[t("div",O,[P,l.value?(g(),M(w,{key:0,severity:"error"},{default:a(()=>[u(T(l.value),1)]),_:1})):A("",!0),t("div",R,[q,s(f,{modelValue:d.value,"onUpdate:modelValue":e[0]||(e[0]=r=>d.value=r),type:"email",placeholder:"Votre adresse email",class:"w-full",disabled:n.value},null,8,["modelValue","disabled"])]),t("div",z,[F,s(f,{modelValue:i.value,"onUpdate:modelValue":e[1]||(e[1]=r=>i.value=r),type:"password",placeholder:"Votre mot de passe",class:"w-full",disabled:n.value},null,8,["modelValue","disabled"])])]),t("div",G,[t("div",H,[s(_,{loading:n.value,type:"submit",design:"4"},{default:a(()=>[u(" Se connecter ")]),_:1},8,["loading"])]),t("div",K,[s(_,{to:"/auth/register",design:"1",onClick:e[2]||(e[2]=r=>x(m).push("/auth/register"))},{default:a(()=>[u(" Je n'ai pas encore de compte, je m'inscris ")]),_:1})]),t("div",L,[s(_,{design:"1",onClick:e[3]||(e[3]=r=>x(m).push("/auth/forgot-password"))},{default:a(()=>[u(" J'ai oublié mon mot de passe ")]),_:1})])])],40,U)]),_:1})]),_:1})])}}};export{te as default};
//# sourceMappingURL=login.8839ad0d.js.map
