diff --git a/frontend/src/api/dingtalk.ts b/frontend/src/api/dingtalk.ts index 86ae837..6756501 100644 --- a/frontend/src/api/dingtalk.ts +++ b/frontend/src/api/dingtalk.ts @@ -1,5 +1,4 @@ import request from '@/utils/request' -import axios from 'axios' import type { Result } from '@/api/types' // 钉钉配置接口类型 @@ -71,12 +70,11 @@ export function getDingTalkDepartments(): Promise { */ export function syncDingTalkDepartments(): Promise { // 同步部门操作可能需要较长时间,设置超时时间为60秒 - const token = localStorage.getItem('token') - return axios.post>('/api/dingtalk/sync-departments', {}, { - timeout: 60000, - headers: token ? { 'Authorization': `Bearer ${token}` } : {} + // 使用request实例,但通过直接调用axios的方法来设置超时 + return (request as any).post>('/dingtalk/sync-departments', {}, { + timeout: 60000 }) - .then(res => res.data.data) + .then((res: Result) => res.data) } /**