api-farmer 0.0.15 → 0.0.16
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.
- package/README.md +0 -1
- package/package.json +1 -1
- package/templates/axios.ejs +1 -1
- package/templates/axle.ejs +1 -1
package/README.md
CHANGED
|
@@ -51,7 +51,6 @@ npx af
|
|
|
51
51
|
|
|
52
52
|
> [!TIP]
|
|
53
53
|
> The generated content does not include the integration of the request client.
|
|
54
|
-
> If you allow ts code output, you will see a custom type called `Res`. This type needs to be defined in `global.d.ts` for use.
|
|
55
54
|
|
|
56
55
|
#### Some Examples
|
|
57
56
|
|
package/package.json
CHANGED
package/templates/axios.ejs
CHANGED
|
@@ -4,7 +4,7 @@ import { request } from '@/request'
|
|
|
4
4
|
|
|
5
5
|
<% apiModule.payloads.forEach(payload => { %> -%>
|
|
6
6
|
export const <%- payload.fn %> = (config<% if (ts) { %>: AxiosRequestConfig<<%- payload.typeRequestBody %>> <% } %>)
|
|
7
|
-
=> request<% if (ts) { %><any,
|
|
7
|
+
=> request<% if (ts) { %><any, <%- payload.typeResponseBody %>><% } %>({
|
|
8
8
|
url: '<%- payload.url %>',
|
|
9
9
|
method: '<%- payload.method %>',
|
|
10
10
|
...config
|
package/templates/axle.ejs
CHANGED
|
@@ -4,7 +4,7 @@ import { api } from '@/request'
|
|
|
4
4
|
<% apiModule.payloads.forEach(payload => { %> -%>
|
|
5
5
|
export const <%- payload.fn %> = api
|
|
6
6
|
<% if (ts) { %>
|
|
7
|
-
|
|
7
|
+
<<%- payload.typeResponseBody %>,
|
|
8
8
|
<% if (['get', 'delete', 'head', 'options'].includes(payload.method)) { %>
|
|
9
9
|
<%- payload.typeQuery %>
|
|
10
10
|
<% } else { %>
|