File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 11import axios , { AxiosRequestConfig } from 'axios' ;
22import { message as $message } from 'antd' ;
33
4- axios . defaults . timeout = 6000 ;
4+ const axiosInstance = axios . create ( {
5+ timeout : 6000
6+ } ) ;
57
6- axios . interceptors . request . use (
8+ axiosInstance . interceptors . request . use (
79 config => {
810 return config ;
911 } ,
@@ -12,7 +14,7 @@ axios.interceptors.request.use(
1214 }
1315) ;
1416
15- axios . interceptors . response . use (
17+ axiosInstance . interceptors . response . use (
1618 config => {
1719 if ( config ?. data ?. message ) {
1820 // $message.success(config.data.message)
@@ -60,9 +62,9 @@ export const request = <T = any>(
6062 const prefix = '' ;
6163 url = prefix + url ;
6264 if ( method === 'post' ) {
63- return axios . post ( url , data , config ) ;
65+ return axiosInstance . post ( url , data , config ) ;
6466 } else {
65- return axios . get ( url , {
67+ return axiosInstance . get ( url , {
6668 params : data ,
6769 ...config
6870 } ) ;
You can’t perform that action at this time.
0 commit comments