-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnet.js
39 lines (37 loc) · 887 Bytes
/
net.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import axios from 'axios'
export const net = {
request(config) {
return axios.request(config)
},
get(url, config) {
const defaultConfig = {
// needed for IE
headers: {
Pragma: 'no-cache',
},
}
const newConfig = Object.assign(defaultConfig, config)
return axios.get(url, newConfig)
},
delete(url, config) {
return axios.delete(url, config)
},
head(url, config) {
return axios.head(url, config)
},
post(url, data, config) {
return axios.post(url, data, config)
},
put(url, data, config) {
return axios.put(url, data, config)
},
patch(url, data, config) {
return axios.patch(url, data, config)
},
}
export default {
install(Vue) {
Vue.$net = net
Vue.prototype.$net = net
},
}