diff --git a/README.md b/README.md
index d618d10..05b4641 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
### Intro
-A tool library based on axios to simplify the development process
+Progressive request tool based on axios.
### Quickstart
@@ -30,8 +30,16 @@ const axle = createAxle(/** @see https://axios-http.com **/)
// The built-in axios of the axle, the usage is exactly the same as that of axios, and shares the configuration with the axle.
const { axios } = axle
-const response = await axle.get('/user', { current: 1, pageSize: 10 }, { headers: {} })
-const response = await axle.post('/user', { name: 'Axle' }, { headers: {} })
+axios.interceptors.response.use(
+ response => response,
+ error => Promise.reject(error)
+)
+
+const response = await axle.get('/url', { current: 1, pageSize: 10 }, { headers: {} })
+const response = await axle.post('/url', { name: 'Axle' }, { headers: {} })
+const response = await axle.getBlob('/url')
+const response = await axle.postJSON('/url', { name: 'Axle' }, { headers: {} })
+const response = await axle.postMultipart('/url', { name: 'Axle', file: new File() })
```
### Vue Composition Api
@@ -42,11 +50,9 @@ import { createAxle } from '@varlet/axle'
import { createUseAxle } from '@varlet/axle/use'
const axle = createAxle(/** @see https://axios-http.com **/)
-const useAxle = createUseAxle(/** @see https://github.com/varletjs/axle/blob/main/src/use.ts?plain=1#L5 **/)
+const useAxle = createUseAxle(/** Unstable **/)
-// default immediate request
-const [users, getUsers, loading, { error }] = useAxle({
- /** @see https://github.com/varletjs/axle/blob/main/src/use.ts?plain=1#L26 **/
+const [users, getUsers, { loading, error }] = useAxle({
runner: axle.get,
url: '/user',
params: { current: 1, pageSize: 10 },
diff --git a/playground/src/App.vue b/playground/src/App.vue
index 0d48799..e0d044d 100644
--- a/playground/src/App.vue
+++ b/playground/src/App.vue
@@ -1,22 +1,22 @@
@@ -129,7 +129,7 @@ watch(
- Search
+ Search
Abort
@@ -162,7 +162,7 @@ watch(
Download Progress: {{ downloadProgress * 100 }} %
File Size: {{ file?.size ?? 0 }}
- apiDownloadFile()">Download (PS: Please use slow 3G)
+ downloadFile()">Download (PS: Please use slow 3G)
@@ -171,6 +171,6 @@ watch(
name: throw error
loading: {{ isThrowErrorLoading }}
data: {{ errorUser ?? 'No Data' }}
- apiThrowError()">Retry
+ throwError()">Retry
diff --git a/playground/src/apis/index.ts b/playground/src/apis/index.ts
index 3aeea46..c0467bf 100644
--- a/playground/src/apis/index.ts
+++ b/playground/src/apis/index.ts
@@ -14,7 +14,7 @@ export interface User {
export type Options> = Partial, 'data'>>
-export function useApiGetUsers(data: D, options?: Options>) {
+export function useGetUsers(data: D, options?: Options>) {
return useAxle({
data,
url: '/user/list-user',
@@ -23,7 +23,7 @@ export function useApiGetUsers(data: D, options?: Options
})
}
-export function useApiGetUser(data: D, options?: Options>) {
+export function useGetUser(data: D, options?: Options>) {
return useAxle({
data,
url: '/user/get-user',
@@ -32,7 +32,7 @@ export function useApiGetUser(data: D, options?: Options>)
})
}
-export function useApiAddUser(data: D, options?: Options>) {
+export function useAddUser(data: D, options?: Options>) {
return useAxle({
data,
url: '/user/add-user',
@@ -41,7 +41,7 @@ export function useApiAddUser(data: D, options?: Options>)
})
}
-export function useApiDeleteUser(data: D, options?: Options>) {
+export function useDeleteUser(data: D, options?: Options>) {
return useAxle({
data,
url: '/user/delete-user',
@@ -50,7 +50,7 @@ export function useApiDeleteUser(data: D, options?: Options
})
}
-export function useApiUpdateUser(data: D, options?: Options>) {
+export function useUpdateUser(data: D, options?: Options>) {
return useAxle({
data,
url: '/user/update-user',
@@ -59,7 +59,7 @@ export function useApiUpdateUser(data: D, options?: Options
})
}
-export function useApiPatchUser(data: D, options?: Options>) {
+export function usePatchUser(data: D, options?: Options>) {
return useAxle({
data,
url: '/user/patch-user',
@@ -68,7 +68,7 @@ export function useApiPatchUser(data: D, options?: Options>
})
}
-export function useApiDownloadFile(data: D, options?: Options) {
+export function useDownloadFile(data: D, options?: Options) {
return useAxle({
data,
url: 'http://localhost:5173/logo.png',
@@ -77,7 +77,7 @@ export function useApiDownloadFile(data: D, options?: Options) {
})
}
-export function useApiThrowError(data: D, options?: Options>) {
+export function useThrowError(data: D, options?: Options>) {
return useAxle({
data,
url: '/user/throw-error',