21 lines
425 B
TypeScript
21 lines
425 B
TypeScript
|
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
|
||
|
}
|