refactor(请求): 去掉 axios,所有请求统一从 authFetch 出门;换 token 时断网不再平白弹登录框
Deploy / deploy (push) Canceled after 0s

utils/api 改成基于 authFetch 的一层 fetch 封装,调用方用法不变;下载测试点也走
authFetch,token 过期时会换一张重试。换 token 那一步断网时,AI 流式接口和自学上报
原来会拿掉 token 重发、弹登录框,现在和普通请求一样报「网络异常」。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-20 19:39:19 +08:00
1 parent 13843c79a0
commit d6c3171d13
9 files changed
+103 -192

No files matched your search

+2 -6
View File
@@ -304,9 +304,7 @@ export async function uploadImage(file: File): Promise<string> {
success: boolean
filePath: string
msg: string
}>("admin/upload-image", form, {
headers: { "content-type": "multipart/form-data" },
})
}>("admin/upload-image", form)
return res.success ? res.filePath : ""
}
@@ -317,9 +315,7 @@ export function uploadTestcases(file: File, options: { sql?: boolean } = {}) {
if (options.sql) {
form.append("sql", "1")
}
return api.post<UploadTestCaseResponse>("admin/test-cases", form, {
headers: { "content-type": "multipart/form-data" },
})
return api.post<UploadTestCaseResponse>("admin/test-cases", form)
}
// SQL 题测试点预览:后端跑一遍初始化脚本+标准答案,返回数据表和期望结果展示数据