index.js
1.03 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import axios from "./axios";
let instance = axios();
export default {
get(url, params, headers) {
let options = {};
if (params) {
options.params = params;
}
if (headers) {
options.headers = headers;
}
return instance.get(url, options);
},
post(url, data, headers, params) {
let options = {};
if (params) {
options.params = params;
}
if (headers) {
options.headers = headers;
}
return instance.post(url, data, options);
},
put(url, params, headers) {
let options = {};
if (headers) {
options.headers = headers;
}
return instance.put(url, params, options);
},
post2(url, params, headers) {
let options = {};
if (headers) {
options.headers = headers;
}
return instance.post(url, params, options);
},
delete(url, params, headers) {
let options = {};
if (params) {
options.data = params
}
if (headers) {
options.headers = headers;
}
return instance.delete(url, options);
}
};