mirror of
https://gitee.com/270580156/weiyu.git
synced 2025-12-30 10:52:26 +00:00
2 lines
858 B
JavaScript
2 lines
858 B
JavaScript
import{r as c,u as o,a as i,T as h}from"./index-DbNlhIML.js";async function u(e){return c("/api/v1/thread/query",{method:"GET",params:{...e}})}const l={async loadThreads(){const{setThreads:e,setLoading:r,setError:a}=o.getState();try{r(!0),a(null);const t={pageNumber:0,pageSize:100,type:h},s=await u(t);if(console.log("queryThreads response",s.data,t),s.data.code===200){const n=s.data.data.content.filter(d=>!d.hide);e(n)}else throw new Error(s.data.message)}catch(t){a(t instanceof Error?t.message:"加载会话失败")}finally{r(!1)}},async resetAndLoad(){const{setPagination:e}=o.getState(),r=i.getState().currentOrg;return e({pageNumber:0,pageSize:100,total:0}),this.loadThreads(r.uid)},async loadThreadsWithFilters(e){const{setFilter:r}=o.getState();return Object.entries(e).forEach(([a,t])=>{r(a,t)}),this.resetAndLoad()}};export{l as threadService};
|