1import{t as s}from"./ClnHdtQV.js";import{u as i,b as l,f as n,j as c}from"./ZPaimFvj.js";import{m as u}from"./BBtaoddy.js";import{emailRegex as d,VERIFY_TYPE as m}from"./BzQM-gab.js";const h=(e,t)=>{const{$toast:r}=i();return{handleLogin:async()=>{if(!e.value.email.trim()){r.error("Email can not be empty");return}if(!d.test(e.value.email)){r.error("Incorrectly formed email");return}if(!e.value.password.trim()){r.error("Password can not be empty");return}const o=await $fetch("/gateway/user/user/login",{method:"POST",body:{email:e.value.email,password:u(e.value.password),emailCode:e.value.emailCode}}).catch(a=>{console.log(a)});o?.code===0?(s("login",{method:"email"}),r.success("Login success"),l(o.data.token),n(o.data),c()):o?.data?.verifyType===m.LOGIN_IP_CHANGE?t(o):r.error(o?.message||"Server error")}}};export{h as useLogin};
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.