import axios from "axios" ; import { Logger } from "./logger" ; const logger = Logger . of ( "request" ) ; axios . interceptors . request . use ( function ( config ) { logger . info ( "网络请求:" , JSON . stringify ( config ) ) ; return config ; } , function ( err ) { logger . error ( "网络失败:" , err ) ; return Promise . reject ( err ) ; } ) ; axios . interceptors . response . use ( function ( response ) { logger . info ( "网络响应成功:" , JSON . stringify ( response ) ) ; return response ; } , function ( err ) { logger . error ( "网络响应错误:" , err ) ; return Promise . reject ( err ) ; } ) ; export const AxiosGet = axios . create ( { method : "get" , timeout : 2 * 60 * 1000 , } ) ; export const AxiosPost = axios . create ( { method : "post" , timeout : 2 * 60 * 1000 , } ) ; export const request = axios . create ( { timeout : 1 * 60 * 1000 , } ) ;