fix: 修复axios已知问题

This commit is contained in:
kailong321200875
2022-06-24 19:58:18 +08:00
parent f4c940d95e
commit 537af57a0a
4 changed files with 15 additions and 22 deletions

View File

@@ -6,7 +6,7 @@ import { config } from '@/config/axios/config'
const { default_headers } = config
const request = <T>(option: AxiosConfig): AxiosPromise<T> => {
const request = (option: AxiosConfig) => {
const { url, method, params, data, headersType, responseType } = option
return service({
url: url,
@@ -21,19 +21,19 @@ const request = <T>(option: AxiosConfig): AxiosPromise<T> => {
}
function getFn<T = any>(option: AxiosConfig): AxiosPromise<T> {
return request<T>({ method: 'get', ...option })
return request({ method: 'get', ...option })
}
function postFn<T = any>(option: AxiosConfig): AxiosPromise<T> {
return request<T>({ method: 'post', ...option })
return request({ method: 'post', ...option })
}
function deleteFn<T = any>(option: AxiosConfig): AxiosPromise<T> {
return request<T>({ method: 'delete', ...option })
return request({ method: 'delete', ...option })
}
function putFn<T = any>(option: AxiosConfig): AxiosPromise<T> {
return request<T>({ method: 'put', ...option })
return request({ method: 'put', ...option })
}
export const useAxios = () => {