2 lines
3.5 KiB
JavaScript
2 lines
3.5 KiB
JavaScript
import{n as P,_ as F,u as b,a as R,b as A,r as H,c as j,d as p,e as E,j as s,F as T,S as l,f as t,A as h,R as f,I as q,g as B,h as _,L as w,i as x,k as U,o as W,l as g,m as D,T as d,C as $,B as z,p as M,q as G,s as N,t as n}from"./index.eaf14aef.js";import{P as V}from"./Page.c2cde06d.js";import{P as J}from"./paths.3971dbe6.js";import{R as K}from"./RHFCheckbox.eaa17da9.js";import{C as O}from"./Card.4687a3ba.js";import"./FormControlLabel.877bb59b.js";import"./Checkbox.114833ca.js";function Q(e){return e.charAt(0).toUpperCase()+e.substr(1)}function X(e){return Q(e.toLowerCase())}function Y(e,a){return a===void 0&&(a={}),P(e,F({delimiter:" ",transform:X},a))}function Z(){const{login:e}=b(),a=R(),r=A(),[o,y]=H.exports.useState(!1),v=j().shape({email:p().email("Email must be a valid email address").required("Email is required"),password:p().required("Password is required")}),C={email:"admin@linksehat.dev",password:"password",remember:!0},c=E({resolver:W(v),defaultValues:C}),{reset:S,setError:k,handleSubmit:I,formState:{errors:m,isSubmitting:L}}=c;return s(T,{methods:c,onSubmit:I(async u=>{try{const i=await e(u.email,u.password);a("/dashboard")}catch(i){console.error(i),S(),r.current&&k("afterSubmit",{...i,message:i.data.message})}}),children:[s(l,{spacing:3,children:[t(h,{severity:"info",children:"Email : admin@linksehat.dev & Password : password"}),!!m.afterSubmit&&t(h,{severity:"error",children:m.afterSubmit.message}),t(f,{name:"email",label:"Email address"}),t(f,{name:"password",label:"Password",type:o?"text":"password",InputProps:{endAdornment:t(q,{position:"end",children:t(B,{onClick:()=>y(!o),edge:"end",children:t(_,{icon:o?"eva:eye-fill":"eva:eye-off-fill"})})})}})]}),s(l,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{my:2},children:[t(K,{name:"remember",label:"Remember me"}),t(w,{component:x,variant:"subtitle2",to:J.resetPassword,children:"Forgot password?"})]}),t(U,{fullWidth:!0,size:"large",type:"submit",variant:"contained",loading:L,children:"Login"})]})}const ee=n("div")(({theme:e})=>({[e.breakpoints.up("md")]:{display:"flex"}})),te=n("header")(({theme:e})=>({top:0,zIndex:9,lineHeight:0,width:"100%",display:"flex",alignItems:"center",position:"absolute",padding:e.spacing(3),justifyContent:"space-between",[e.breakpoints.up("md")]:{alignItems:"flex-start",padding:e.spacing(7,5,0,7)}}));n(O)(({theme:e})=>({width:"100%",maxWidth:464,display:"flex",flexDirection:"column",justifyContent:"center",margin:e.spacing(2,0,2,2)}));const se=n("div")(({theme:e})=>({maxWidth:480,margin:"auto",display:"flex",minHeight:"100vh",flexDirection:"column",justifyContent:"center",padding:e.spacing(12,0)}));function me(){const{method:e}=b(),a=g("up","sm");return g("up","md"),t(V,{title:"Login",children:s(ee,{children:[s(te,{children:[t(D,{sx:{width:150,height:150}}),a&&s(d,{variant:"body2",sx:{mt:{md:-2}},children:["Has problem with your account? ","",t(w,{variant:"subtitle2",component:x,to:"#",onClick:r=>{window.location.href="mailto:admin@linksehat.com",r.preventDefault()},children:"Contact Us"})]})]}),t($,{maxWidth:"sm",children:s(se,{children:[s(l,{direction:"row",alignItems:"center",sx:{mb:5},children:[s(z,{sx:{flexGrow:1},children:[t(d,{variant:"h4",gutterBottom:!0,children:"Sign in to LinkSehat"}),t(d,{sx:{color:"text.secondary"},children:"Enter your details below."})]}),t(M,{title:Y(e),placement:"right",children:t(G,{children:t(N,{disabledEffect:!0,src:`https://minimal-assets-api.vercel.app/assets/icons/auth/ic_${e}.png`,sx:{width:32,height:32}})})})]}),t(Z,{}),!1]})})]})})}export{me as default};
|