Skip to content

Commit

Permalink
feat: support retry interceptor and fix types error
Browse files Browse the repository at this point in the history
  • Loading branch information
haoziqaq committed Dec 2, 2023
1 parent 4802e8f commit f47a462
Show file tree
Hide file tree
Showing 19 changed files with 1,619 additions and 2,468 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"root": true,
"extends": ["@varlet"],
"ignorePatterns": ["node_modules", "es", "dist"]
"ignorePatterns": ["node_modules", "es", "dist", "playground"]
}
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ axle.removeHeader('TOKEN')

## Vue Composition API

Axle provides the usage of Vue Composition API style, which encapsulates the `loading status`, `error status`, `upload and download progress` of the request, `return data`, `error retry`, `lifecycle`, etc., And inherit all the configuration of `axios`.
Axle provides the usage of Vue Composition API style, which encapsulates the `loading status`, `error status`, `upload and download progress` of the request, `return data`, `lifecycle`, etc., And inherit all the configuration of `axios`.

```html
<script setup>
Expand All @@ -223,8 +223,6 @@ const [users, getUsers, { loading, error, uploadProgress, downloadProgress, abor
url: '/user',
// Whether to send the request immediately, defaults false
immediate: true,
// The number of retries after a failed request, defaults 0
retry: 3,
// Whether the value needs to be reset before requesting, defaults false
resetValue: true,
// Request params, defaults {}
Expand Down
4 changes: 1 addition & 3 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ axle.removeHeader('TOKEN')

## Vue 组合式 API

Axle 提供了 Vue Composition API 风格的用法,封装了请求的 `加载状态`, `错误状态`, `请求的上下行进度``返回数据``错误重试``生命周期` 等等,并继承了 `axios` 的所有配置。
Axle 提供了 Vue Composition API 风格的用法,封装了请求的 `加载状态`, `错误状态`, `请求的上下行进度``返回数据``生命周期` 等等,并继承了 `axios` 的所有配置。

```html
<script setup>
Expand All @@ -223,8 +223,6 @@ const [users, getUsers, { loading, error, uploadProgress, downloadProgress, abor
url: '/user',
// 是否立即发送请求, 默认值: false
immediate: true,
// 错误重试次数, 默认值: 0
retry: 3,
// 请求前是否需要重置 value, 默认值: false
resetValue: true,
// 请求参数, 默认值: {}
Expand Down
2 changes: 2 additions & 0 deletions playground/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shamefully-hoist=true
strict-peer-dependencies=false
3 changes: 1 addition & 2 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"koa-bodyparser": "^4.4.0",
"koa-router": "^12.0.0",
"nodemon": "^2.0.15",
"unplugin-auto-import": "^0.16.2",
"vue": "^3.3.1"
"unplugin-auto-import": "^0.16.2"
},
"devDependencies": {
"@types/node": "^17.0.23",
Expand Down
Loading

0 comments on commit f47a462

Please sign in to comment.