1 |
- import{w as l,Z as m,ag as p,v as H,l as N,aN as h}from"./index.js";function k(){const{logout:a}=H();function s({code:t,message:r,handler:n}){const e=Number(t);e===0?n():e>=100&&e<=140?a():h.error(r)}return s}function T({initialData:a,root:s=!0,success:t}={root:!0}){const r=l(a),n=l(!1),e=l(!1),i=k(),c=o=>r.value=o;function d(o){return e.value=!0,o.then(v=>{e.value=!1;const{code:f,message:g,data:u}=v;String(f)!=="0"&&(n.value=!0),i({code:f,message:g,handler:()=>{n.value=!1,c(s?u:u.list),t&&t(N(u))}})})}return m({run:d,data:r,setData:c,loading:e,isError:n})}function b(...a){return p(()=>a.some(s=>s.loading))}export{b as a,T as u};
|