🐛 fix头像、文章资源上传失败
This commit is contained in:
parent
032d88c996
commit
d95fdf0021
@ -5,7 +5,7 @@ export function upload(data) {
|
||||
url: '/common/UploadFile',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
}
|
||||
|
||||
@ -18,6 +18,6 @@ export function sendEmail(data) {
|
||||
return request({
|
||||
url: '/common/SendEmail',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
@ -116,7 +116,8 @@ export function uploadAvatar(data) {
|
||||
return request({
|
||||
url: '/system/user/profile/avatar',
|
||||
method: 'post',
|
||||
data: data
|
||||
data: data,
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -29,8 +29,9 @@ service.interceptors.request.use(
|
||||
config.headers['userName'] = useUserStore().userName
|
||||
}
|
||||
const method = config?.method || 'get'
|
||||
const header = config?.headers['Content-Type'] ?? ''
|
||||
|
||||
if (method.toLowerCase() === 'post' || method.toLowerCase() === 'put') {
|
||||
if ((method.toLowerCase() === 'post' || method.toLowerCase() === 'put') && header != 'multipart/form-data') {
|
||||
config.data = delEmptyQueryNodes(config.data)
|
||||
}
|
||||
return config
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user