import Vue from 'vue'
import axios from 'axios'
// Vue.use(axios)
export function getHttp(url, params) {
return new Promise((resolve, reject) => {
axios.get(url, {
params: params
}).then(res => {
console.log(res)
resolve(res.data)
}).catch(err => {
reject(err)
})
});
}
export function postHttp(url, params, config){
if (config == null) {
config = {"headers": {"Content-Type": "application/json"}}
}
var tmout = config["timeout"]
if (tmout === null) {
config["timeout"] = 1000*60*5;
}
return new Promise((resolve, reject) =>{
axios.post(url, params, config).then(res => {
resolve(res.data);
}).catch(err =>{
reject(err.data)
})
});
}