useTask.8a645393.js 539 B

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