fix: 修复request请求自定义headers类型错误
This commit is contained in:
parent
649fb17d00
commit
bf2cd720d0
|
@ -1,4 +1,4 @@
|
|||
import { AxiosResponse, AxiosRequestHeaders, InternalAxiosRequestConfig } from './types'
|
||||
import { AxiosResponse, InternalAxiosRequestConfig } from './types'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import qs from 'qs'
|
||||
import { SUCCESS_CODE } from '@/constants'
|
||||
|
@ -7,7 +7,7 @@ import { useUserStoreWithOut } from '@/store/modules/user'
|
|||
const defaultRequestInterceptors = (config: InternalAxiosRequestConfig) => {
|
||||
if (
|
||||
config.method === 'post' &&
|
||||
(config.headers as AxiosRequestHeaders)['Content-Type'] === 'application/x-www-form-urlencoded'
|
||||
config.headers['Content-Type'] === 'application/x-www-form-urlencoded'
|
||||
) {
|
||||
config.data = qs.stringify(config.data)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { CSSProperties } from 'vue'
|
||||
import { AxiosRequestHeaders } from 'axios'
|
||||
import { RawAxiosRequestHeaders } from 'axios'
|
||||
declare global {
|
||||
declare interface Fn<T = any> {
|
||||
(...arg: T[]): T
|
||||
|
@ -40,7 +40,7 @@ declare global {
|
|||
data?: any
|
||||
url?: string
|
||||
method?: AxiosMethod
|
||||
headers?: AxiosRequestHeaders
|
||||
headers?: RawAxiosRequestHeaders
|
||||
responseType?: AxiosResponseType
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue