Auto backup \2026-\04-\20
This commit is contained in:
@@ -20,6 +20,14 @@ api.interceptors.request.use(
|
||||
if (token) {
|
||||
config.headers.Authorization = `Bearer ${token}`
|
||||
}
|
||||
// FormData 上传必须移除 JSON 默认 Content-Type,让浏览器自动加 multipart boundary
|
||||
if (typeof FormData !== 'undefined' && config.data instanceof FormData) {
|
||||
if (typeof config.headers.delete === 'function') {
|
||||
config.headers.delete('Content-Type')
|
||||
} else {
|
||||
delete config.headers['Content-Type']
|
||||
}
|
||||
}
|
||||
return config
|
||||
},
|
||||
(error) => Promise.reject(error)
|
||||
|
||||
Reference in New Issue
Block a user