修复同步部门接口超时设置(使用request实例)
This commit is contained in:
parent
9256c0e2da
commit
f36ec495a2
@ -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<any[]> {
|
||||
*/
|
||||
export function syncDingTalkDepartments(): Promise<number> {
|
||||
// 同步部门操作可能需要较长时间,设置超时时间为60秒
|
||||
const token = localStorage.getItem('token')
|
||||
return axios.post<Result<number>>('/api/dingtalk/sync-departments', {}, {
|
||||
timeout: 60000,
|
||||
headers: token ? { 'Authorization': `Bearer ${token}` } : {}
|
||||
// 使用request实例,但通过直接调用axios的方法来设置超时
|
||||
return (request as any).post<Result<number>>('/dingtalk/sync-departments', {}, {
|
||||
timeout: 60000
|
||||
})
|
||||
.then(res => res.data.data)
|
||||
.then((res: Result<number>) => res.data)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user