@lark-apaas/miaoda-core 0.0.1-alpha.2 → 0.0.1-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,29 +10,29 @@ declare function getLogJson(): Promise<{}>;
|
|
10
10
|
/**
|
11
11
|
* GET 请求
|
12
12
|
*/
|
13
|
-
declare function api_get(url: any, config: any): Promise<
|
13
|
+
declare function api_get(url: any, config: any): Promise<any>;
|
14
14
|
/**
|
15
15
|
* POST 请求
|
16
16
|
*/
|
17
|
-
declare function api_post(url: any, data: any, config: any): Promise<
|
17
|
+
declare function api_post(url: any, data: any, config: any): Promise<any>;
|
18
18
|
/**
|
19
19
|
* PUT 请求
|
20
20
|
*/
|
21
|
-
declare function api_put(url: any, data: any, config: any): Promise<
|
21
|
+
declare function api_put(url: any, data: any, config: any): Promise<any>;
|
22
22
|
/**
|
23
23
|
* DELETE 请求
|
24
24
|
*/
|
25
|
-
declare function api_delete(url: any, config: any): Promise<
|
25
|
+
declare function api_delete(url: any, config: any): Promise<any>;
|
26
26
|
/**
|
27
27
|
* PATCH 请求
|
28
28
|
*/
|
29
|
-
declare function api_patch(url: any, data: any, config: any): Promise<
|
29
|
+
declare function api_patch(url: any, data: any, config: any): Promise<any>;
|
30
30
|
/**
|
31
31
|
* HEAD 请求
|
32
32
|
*/
|
33
|
-
declare function api_head(url: any, config: any): Promise<
|
33
|
+
declare function api_head(url: any, config: any): Promise<any>;
|
34
34
|
/**
|
35
35
|
* OPTIONS 请求
|
36
36
|
*/
|
37
|
-
declare function api_options(url: any, config: any): Promise<
|
37
|
+
declare function api_options(url: any, config: any): Promise<any>;
|
38
38
|
export { getOpenApiJson, getLogJson, api_get, api_post, api_put, api_delete, api_patch, api_head, api_options, };
|
@@ -24,61 +24,37 @@ async function getLogJson() {
|
|
24
24
|
}
|
25
25
|
async function api_get(url, config) {
|
26
26
|
const basePath = normalizeBasePath(process.env.CLIENT_BASE_PATH);
|
27
|
-
|
28
|
-
|
29
|
-
url: `${basePath}${url}`,
|
30
|
-
method: 'GET'
|
31
|
-
});
|
27
|
+
const res = await core.get(`${basePath}${url}`, config);
|
28
|
+
return res.data;
|
32
29
|
}
|
33
30
|
async function api_post(url, data, config) {
|
34
31
|
const basePath = normalizeBasePath(process.env.CLIENT_BASE_PATH);
|
35
|
-
|
36
|
-
|
37
|
-
url: `${basePath}${url}`,
|
38
|
-
method: 'POST',
|
39
|
-
data
|
40
|
-
});
|
32
|
+
const res = await core.post(`${basePath}${url}`, data, config);
|
33
|
+
return res.data;
|
41
34
|
}
|
42
35
|
async function api_put(url, data, config) {
|
43
36
|
const basePath = normalizeBasePath(process.env.CLIENT_BASE_PATH);
|
44
|
-
|
45
|
-
|
46
|
-
url: `${basePath}${url}`,
|
47
|
-
method: 'PUT',
|
48
|
-
data
|
49
|
-
});
|
37
|
+
const res = await core.put(`${basePath}${url}`, data, config);
|
38
|
+
return res.data;
|
50
39
|
}
|
51
40
|
async function api_delete(url, config) {
|
52
41
|
const basePath = normalizeBasePath(process.env.CLIENT_BASE_PATH);
|
53
|
-
|
54
|
-
|
55
|
-
url: `${basePath}${url}`,
|
56
|
-
method: 'DELETE'
|
57
|
-
});
|
42
|
+
const res = await core["delete"](`${basePath}${url}`, config);
|
43
|
+
return res.data;
|
58
44
|
}
|
59
45
|
async function api_patch(url, data, config) {
|
60
46
|
const basePath = normalizeBasePath(process.env.CLIENT_BASE_PATH);
|
61
|
-
|
62
|
-
|
63
|
-
url: `${basePath}${url}`,
|
64
|
-
method: 'PATCH',
|
65
|
-
data
|
66
|
-
});
|
47
|
+
const res = await core.patch(`${basePath}${url}`, data, config);
|
48
|
+
return res.data;
|
67
49
|
}
|
68
50
|
async function api_head(url, config) {
|
69
51
|
const basePath = normalizeBasePath(process.env.CLIENT_BASE_PATH);
|
70
|
-
|
71
|
-
|
72
|
-
url: `${basePath}${url}`,
|
73
|
-
method: 'HEAD'
|
74
|
-
});
|
52
|
+
const res = await core.head(`${basePath}${url}`, config);
|
53
|
+
return res.data;
|
75
54
|
}
|
76
55
|
async function api_options(url, config) {
|
77
56
|
const basePath = normalizeBasePath(process.env.CLIENT_BASE_PATH);
|
78
|
-
|
79
|
-
|
80
|
-
url: `${basePath}${url}`,
|
81
|
-
method: 'OPTIONS'
|
82
|
-
});
|
57
|
+
const res = await core.options(`${basePath}${url}`, config);
|
58
|
+
return res.data;
|
83
59
|
}
|
84
60
|
export { api_delete, api_get, api_head, api_options, api_patch, api_post, api_put, getLogJson, getOpenApiJson };
|