fix: 组织架构页面无数据 - 响应拦截器已剥离一层data,无需再取r.data.data
api.ts 响应拦截器 (response) => response.data 已剥离 axios response, OrgChart 中 api.get().then(r => r.data.data) 多取了一层导致返回 undefined。 改为 .then(r => r.data) 即可正确获取部门/岗位数组。 Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -22,12 +22,12 @@ export default function OrgChart() {
|
||||
|
||||
const { data: departments = [], isLoading } = useQuery({
|
||||
queryKey: ['departments'],
|
||||
queryFn: () => api.get('/departments').then(r => r.data.data),
|
||||
queryFn: () => api.get('/departments').then(r => r.data),
|
||||
})
|
||||
|
||||
const { data: positions = [] } = useQuery({
|
||||
queryKey: ['positions'],
|
||||
queryFn: () => api.get('/positions').then(r => r.data.data),
|
||||
queryFn: () => api.get('/positions').then(r => r.data),
|
||||
enabled: tab === 'position',
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user