import axios from 'axios' ; import { message } from 'antd' ; const service = axios . create ( { baseURL : 'http://localhost:32001' , timeout : 15000 , } ) ; service . interceptors . request . use ( config => { return config ; } , error => { return Promise . reject ( error ) ; } ) ; service . interceptors . response . use ( response => { const res = response . data ; if ( res . statusCode !== 200 && res . message ) { message . error ( res . message ) ; return Promise . reject ( 'error' ) ; } return response . data ; } , error => { message . error ( error . message ) ; return Promise . reject ( error ) ; } ) ; export default service ;