1- import type { AxiosRequestConfig , AxiosInstance } from 'axios' ;
1+ import type { AxiosRequestConfig , RawAxiosRequestHeaders } from 'axios' ;
22import { CONTENT_TYPE , type ContentTypeValue } from './constant' ;
33import type { RequestConfig , RequiredRequestConfig } from '../types' ;
44
@@ -14,9 +14,7 @@ export function createDefaultRequestConfig(requestConfig?: RequestConfig) {
1414 return responseData [ codeKey ] === BACKEND_SUCCESS_CODE ;
1515 } ,
1616 onBackendFail : async ( ) => { } ,
17- onError : async ( { error } ) => {
18- window . console . log ( `code: ${ error . code } , msg: ${ error . msg } ` ) ;
19- }
17+ onError : async ( ) => { }
2018 } ;
2119
2220 Object . assign ( configs , requestConfig ) ;
@@ -25,7 +23,9 @@ export function createDefaultRequestConfig(requestConfig?: RequestConfig) {
2523}
2624
2725export function getRequestHeaderContentType ( config : AxiosRequestConfig ) {
28- const contentType = ( config ?. headers ?. [ 'Content-Type' ] || CONTENT_TYPE . json ) as ContentTypeValue ;
26+ const headerContentType = ( config ?. headers as RawAxiosRequestHeaders ) ?. [ 'Content-Type' ] ;
27+
28+ const contentType = ( headerContentType || CONTENT_TYPE . json ) as ContentTypeValue ;
2929
3030 return contentType ;
3131}
@@ -38,6 +38,3 @@ export function isHttpSuccess(status: number) {
3838 const isSuccessCode = status >= 200 && status < 300 ;
3939 return isSuccessCode || status === 304 ;
4040}
41-
42- // eslint-disable-next-line @typescript-eslint/no-unused-vars
43- export function getCustomRequestInstance ( instance : AxiosInstance ) { }
0 commit comments