beelink/src/api/base.ts

21 lines
425 B
TypeScript
Raw Normal View History

2020-09-24 07:33:12 +00:00
import axios from '../config/axiosConfig'
import { AxiosPromise } from 'axios';
axios.interceptors.response.use((response)=>{
return response.data;
},(error)=>{
return error;
})
function get(url: string,data?: object): Promise<AxiosPromise> {
return axios.get(url,{params:data})
}
function post(url: string,data?: object): Promise<AxiosPromise> {
return axios.post(url,data)
}
export {
get,
post
}