import{G as s}from"./index-CcdGGfCj.js";import{h as e,c as l,s as n}from"./http-CGjljVXL.js";const h=s("auth",{state:()=>({profile:JSON.parse(localStorage.getItem("admin_profile")||"null"),loading:!1}),getters:{authenticated:()=>!!localStorage.getItem("admin_access_token")},actions:{async login(t,o){this.loading=!0;try{const{data:a}=await e.post("/auth/login",{username:t,password:o});n(a.data),this.profile=a.data.admin}finally{this.loading=!1}},async logout(){const t=localStorage.getItem("admin_refresh_token");try{await e.post("/auth/logout",{refresh_token:t})}finally{l(),this.profile=null}}}});export{h as u};
