import{d as l,D as u,z as i,X as d,Y as g,B as p,C as c,P as f,c as m,o as _}from"./index-DqVhJ65C.js";const h={class:"h-screen w-screen flex items-center justify-center bg-white"},b=l({__name:"SocialCallback",setup(k){const n=g(),o=f(),t=u();return i(async()=>{const r=d.service({text:"正在登录中...",background:"rgba(255, 255, 255, 0.9)"});try{const{code:e,type:a}=n.query;if(!e||!a)throw new Error("参数错误");const s=await p.get("/auth/social/callback",{params:{code:e,type:a}});if(s.code===0)t.setToken(s.data.token),t.setUserInfo(s.data.user),t.setLoginStatus(!0),c.success("登录成功"),o.replace("/dashboard");else throw new Error(s.message||"登录失败")}catch(e){console.error(e),c.error(e.message||"登录失败，请重试"),o.replace("/login")}finally{r.close()}}),(r,e)=>(_(),m("div",h))}});export{b as default};
