allinssl/build/static/js/useStore-h2Wsbe9z.js

2 lines
1.2 KiB
JavaScript

import{u as e}from"./index-3CAadC9a.js";import{a}from"./setting-D80_Gwwn.js";import{e as t,s as o,r as l,l as s}from"./main-DgoEun3x.js";import{u as n,a as r}from"./index-SPRAkzSU.js";import{b as i}from"./access-CoJ081t2.js";const u=t("layout-store",(()=>{const{handleError:t}=e(),o=n("layout-collapsed",!1),u=l([]),c=l([]),v=r("menu-active","home"),d=s((()=>"home"!==v.value?"var(--n-content-padding)":"0"));return{locales:n("locales-active","zhCN"),notifyProvider:u,dnsProvider:c,isCollapsed:o,layoutPadding:d,menuActive:v,resetDataInfo:()=>{v.value="home",sessionStorage.removeItem("menu-active")},updateMenuActive:e=>{"logout"!==e&&(v.value=e)},toggleCollapse:()=>{o.value=!o.value},handleCollapse:()=>{o.value=!0},handleExpand:()=>{o.value=!1},fetchNotifyProvider:async()=>{try{u.value=[];const{data:e}=await a({p:1,search:"",limit:1e3}).fetch();u.value=null==e?void 0:e.map((e=>({label:e.name,value:e.id.toString(),type:e.type})))}catch(e){t(e)}},fetchDnsProvider:async(e="")=>{try{c.value=[];const{data:a}=await i({type:e}).fetch();c.value=(null==a?void 0:a.map((e=>({label:e.name,value:e.id.toString(),type:e.type}))))||[]}catch(a){t(a)}}}})),c=()=>{const e=u();return{...e,...o(e)}};export{c as u};