merge: 合并 origin/main(MiGu.DB 持久层拆分与车辆/OTA 更新)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -13,6 +13,10 @@ const http: AxiosInstance = axios.create({
|
||||
})
|
||||
|
||||
http.interceptors.request.use((config: InternalAxiosRequestConfig) => {
|
||||
// FormData 必须由浏览器自动带 multipart boundary;清掉默认 application/json。
|
||||
if (typeof FormData !== 'undefined' && config.data instanceof FormData) {
|
||||
config.headers.delete('Content-Type')
|
||||
}
|
||||
// 双轨:优先用 localStorage 里的 token(过渡期 fallback),Cookie 会自动带;
|
||||
// 后端首先看 Authorization: Bearer,没有再看 Cookie,两路任一通过即可。
|
||||
const token = localStorage.getItem('simple.auth.token')
|
||||
|
||||
@@ -47,7 +47,6 @@ export async function uploadOtaPackage(file: File): Promise<OtaPackageInfo> {
|
||||
const form = new FormData()
|
||||
form.append('file', file)
|
||||
const { data } = await http.post<OtaPackageInfo>('/ota/packages/upload', form, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
timeout: 300000
|
||||
})
|
||||
return data
|
||||
@@ -116,7 +115,6 @@ export async function pushOtaCustomFile(opts: {
|
||||
form.append('restartOps', JSON.stringify(opts.restartOps.length ? opts.restartOps : [-1]))
|
||||
for (const f of opts.files) form.append('files', f)
|
||||
const { data } = await http.post<OtaJob>('/ota/custom-file', form, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
timeout: 300000
|
||||
})
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user