refactor(frontend): split large reimbursement and audit modules
This commit is contained in:
@@ -269,7 +269,9 @@ export async function apiRequest(path, options = {}) {
|
||||
globalThis.clearTimeout(timeoutId)
|
||||
}
|
||||
if (error?.name === 'AbortError') {
|
||||
throw new Error(String(timeoutMessage || '').trim() || '接口请求超时,请稍后重试。')
|
||||
const timeoutError = new Error(String(timeoutMessage || '').trim() || '接口请求超时,请稍后重试。')
|
||||
timeoutError.code = 'REQUEST_TIMEOUT'
|
||||
throw timeoutError
|
||||
}
|
||||
if (String(error?.message || '').includes('ByteString')) {
|
||||
throw new Error('当前登录用户信息包含浏览器不支持的请求头字符,请重新登录后重试。')
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { apiRequest } from './api.js'
|
||||
|
||||
export function fetchBackendHealth() {
|
||||
return apiRequest('/health')
|
||||
export function fetchBackendHealth(options = {}) {
|
||||
return apiRequest('/health', {
|
||||
timeoutMs: Number(options.timeoutMs || 2500),
|
||||
timeoutMessage: '后端健康检查超时,可能正在处理耗时任务。'
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user