-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajax.ts
More file actions
86 lines (86 loc) · 2.25 KB
/
ajax.ts
File metadata and controls
86 lines (86 loc) · 2.25 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import axios from 'axios';
import qs from 'qs';
export const getApi = async(ajaxCfg)=>{
let data = await axios.get(
ajaxCfg.url,{
params:ajaxCfg.cfg
},
{
headers: ajaxCfg.headers,
})
return data;
}
export const getApi2 = async(url,cfg,headers)=>{
let data = await axios.get(
url,{
params:cfg
},
{
headers: headers,
})
return data;
}
// async postApi(url,cfg,headers){
// let fd = new FormData();
// for(let key in cfg){
// fd.append(key, cfg[key]);
// }
// let data = await axios.post(url,fd,
// {
// headers: headers
// })
// return data;
// },
// async putApi(url,cfg,headers){
// let data = await axios.put(url,qs.stringify(cfg),{
// headers: {
// 'Content-Type':'application/x-www-form-urlencoded',
// }
// })
// return data;
// },
// async _postApi(url,cfg,headers){
// let data = await axios.post(url,cfg,
// {
// headers: headers
// })
// return data;
// },
// async __postApi(url,cfg,headers){
// let data = await axios.post(url,qs.stringify(cfg),{
// headers: {
// 'Content-Type':'application/x-www-form-urlencoded',
// }
// })
// return data;
// },
// async delApi(url,cfg,headers){
// let data = await axios.delete(url,{params:cfg},{
// headers: headers
// })
// return data;
// },
// async requestApi(cfg,headers,file){
// let fd = new FormData();
// fd.append('param', JSON.stringify(cfg));
// if(file){
// // 上传证明
// if(file.length){
// for(let i=0,len=file.length;i<len;i++){
// fd.append('files', file[i]);
// }
// }else {
// // 单个上传
// for(let key in file){
// fd.append(key, file[key]);
// }
// }
// }
// let data = await axios.post('/batch',fd,
// {
// headers: headers
// })
// return data;
// }
// }
// export default Unit;