From 93cbefda77b10a851ff379dd59cd6db0ca3b28e4 Mon Sep 17 00:00:00 2001 From: chouchouji <70570907+chouchouji@users.noreply.github.com> Date: Thu, 16 Jan 2025 20:05:19 +0800 Subject: [PATCH] chore: migrate to @configurajs/eslint and @configurajs/prettier (#18) * chore: migrate to @configurajs/eslint and @configurajs/prettier * chore: ignore axle lib folder * chore: update tsconfig.json --- .eslintrc | 5 - .prettierignore | 3 - .prettierrc | 5 - CHANGELOG.md | 311 +--- README.md | 246 ++- README.zh-CN.md | 246 ++- eslint.config.js | 5 + package.json | 25 +- packages/axle/README.md | 246 ++- packages/axle/README.zh-CN.md | 246 ++- packages/axle/package.json | 66 +- .../src/composables/useAverageProgress.ts | 4 +- .../axle/src/composables/useHasLoading.ts | 4 +- packages/axle/src/composables/useValues.ts | 2 +- packages/axle/src/helper.ts | 2 +- packages/axle/src/instance.ts | 12 +- .../examples/requestHeadersInterceptor.md | 10 +- .../examples/requestMd5Interceptor.md | 10 +- .../examples/requestMockInterceptor.md | 12 +- .../examples/responseBlobInterceptor.md | 6 +- .../examples/responseRetryInterceptor.md | 4 +- .../examples/responseStatusInterceptor.md | 2 +- .../examples/responseTimeoutInterceptor.md | 6 +- .../interceptors/requestHeadersInterceptor.ts | 4 +- .../src/interceptors/requestMd5Interceptor.ts | 10 +- .../interceptors/requestMockInterceptor.ts | 6 +- .../interceptors/responseRetryInterceptor.ts | 2 +- packages/axle/src/use.ts | 12 +- packages/axle/tsconfig.json | 1 + packages/playground/index.html | 2 +- packages/playground/package.json | 2 +- packages/playground/src/App.vue | 8 +- packages/playground/src/env.d.ts | 1 - packages/playground/src/request/index.ts | 4 +- pnpm-lock.yaml | 1448 +++++++++++++++-- prettier.config.js | 3 + tsconfig.json | 1 - 37 files changed, 1968 insertions(+), 1014 deletions(-) delete mode 100644 .eslintrc delete mode 100644 .prettierrc create mode 100644 eslint.config.js create mode 100644 prettier.config.js diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 722a7ce..0000000 --- a/.eslintrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "root": true, - "extends": ["@varlet"], - "ignorePatterns": ["node_modules", "es", "cjs", "lib", "dist", "playground"] -} diff --git a/.prettierignore b/.prettierignore index 9421b29..2173832 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,6 +1,3 @@ -package.json -*.md -.github/** .history/** lib/** es/** diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index b397782..0000000 --- a/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "printWidth": 120, - "singleQuote": true, - "semi": false -} diff --git a/CHANGELOG.md b/CHANGELOG.md index 12451ff..4b15fdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,554 +1,359 @@ ## [0.10.1](https://github.com/varletjs/axle/compare/v0.10.0...v0.10.1) (2024-12-03) - - # [0.10.0](https://github.com/varletjs/axle/compare/v0.9.5...v0.10.0) (2024-12-03) - ### Features -* runner enhancement ([ec1bbab](https://github.com/varletjs/axle/commit/ec1bbab847fb22b0e120f08eb005533ad9563331)) - - +- runner enhancement ([ec1bbab](https://github.com/varletjs/axle/commit/ec1bbab847fb22b0e120f08eb005533ad9563331)) ## [0.9.5](https://github.com/varletjs/axle/compare/v0.9.4...v0.9.5) (2024-12-02) - ### Bug Fixes -* fix expose AxiosError, isAxiosError ([de40e78](https://github.com/varletjs/axle/commit/de40e789f2cb81c818b3ea882acac319bd5400e3)) - - +- fix expose AxiosError, isAxiosError ([de40e78](https://github.com/varletjs/axle/commit/de40e789f2cb81c818b3ea882acac319bd5400e3)) ## [0.9.4](https://github.com/varletjs/axle/compare/v0.9.3...v0.9.4) (2024-12-02) - ### Features -* expose AxiosError class ([06ea121](https://github.com/varletjs/axle/commit/06ea121f5ffbd770d9be971ca88e71f58669439c)) -* expose isAxiosError ([dc9330f](https://github.com/varletjs/axle/commit/dc9330fe3f14d0c1e9c53339434751f7e42151ec)) - - +- expose AxiosError class ([06ea121](https://github.com/varletjs/axle/commit/06ea121f5ffbd770d9be971ca88e71f58669439c)) +- expose isAxiosError ([dc9330f](https://github.com/varletjs/axle/commit/dc9330fe3f14d0c1e9c53339434751f7e42151ec)) ## [0.9.3](https://github.com/varletjs/axle/compare/v0.9.2...v0.9.3) (2024-11-13) - - ## [0.9.2](https://github.com/varletjs/axle/compare/v0.9.1...v0.9.2) (2024-11-13) - ### Features -* support promise onTransform ([fc7c178](https://github.com/varletjs/axle/commit/fc7c178ddc706177331dca38eee55dd14995b3b8)) - - +- support promise onTransform ([fc7c178](https://github.com/varletjs/axle/commit/fc7c178ddc706177331dca38eee55dd14995b3b8)) ## [0.9.1](https://github.com/varletjs/axle/compare/v0.9.0...v0.9.1) (2024-11-08) - - # [0.9.0](https://github.com/varletjs/axle/compare/v0.8.0...v0.9.0) (2024-09-27) - ### Features -* support create api ([018e7c6](https://github.com/varletjs/axle/commit/018e7c6fff34b6c8dda355775076189d62c5eb4c)) - +- support create api ([018e7c6](https://github.com/varletjs/axle/commit/018e7c6fff34b6c8dda355775076189d62c5eb4c)) ### BREAKING CHANGES -* createUseAxle immediate option default value changed to true - - +- createUseAxle immediate option default value changed to true # [0.8.0](https://github.com/varletjs/axle/compare/v0.7.1...v0.8.0) (2024-08-07) - ### Features -* export type of axios ([d279beb](https://github.com/varletjs/axle/commit/d279beba1ca27c30c038e858a554bcacbc242d08)) - - +- export type of axios ([d279beb](https://github.com/varletjs/axle/commit/d279beba1ca27c30c038e858a554bcacbc242d08)) ## [0.7.1](https://github.com/varletjs/axle/compare/v0.7.0...v0.7.1) (2024-04-23) - - # [0.7.0](https://github.com/varletjs/axle/compare/v0.6.0...v0.7.0) (2024-04-23) - ### Features -* add function withResponse ([#16](https://github.com/varletjs/axle/issues/16)) ([7bd290b](https://github.com/varletjs/axle/commit/7bd290ba7244feebad4f5ee42a5574e66f49589c)) - - +- add function withResponse ([#16](https://github.com/varletjs/axle/issues/16)) ([7bd290b](https://github.com/varletjs/axle/commit/7bd290ba7244feebad4f5ee42a5574e66f49589c)) # [0.6.0](https://github.com/varletjs/axle/compare/v0.5.2...v0.6.0) (2024-01-06) - ### types -* refactor runner generic types ([e168ef2](https://github.com/varletjs/axle/commit/e168ef2c17b2831d3e1df819016c315d09178912)) - +- refactor runner generic types ([e168ef2](https://github.com/varletjs/axle/commit/e168ef2c17b2831d3e1df819016c315d09178912)) ### BREAKING CHANGES -* The first generic parameter of runner is changed to response, and the second parameter is changed to params. - - +- The first generic parameter of runner is changed to response, and the second parameter is changed to params. ## [0.5.2](https://github.com/varletjs/axle/compare/v0.5.1...v0.5.2) (2024-01-03) - ### Features -* support treeshaking ([8c05476](https://github.com/varletjs/axle/commit/8c0547652397be8759a84a472568cab7c8113e56)) - - +- support treeshaking ([8c05476](https://github.com/varletjs/axle/commit/8c0547652397be8759a84a472568cab7c8113e56)) ## [0.5.1](https://github.com/varletjs/axle/compare/v0.5.0...v0.5.1) (2024-01-02) - - # [0.5.0](https://github.com/varletjs/axle/compare/v0.4.0...v0.5.0) (2024-01-02) - ### Features -* **use:** support resetValue method and cloneResetValue option ([e4e7bed](https://github.com/varletjs/axle/commit/e4e7bedf04c0ac99936a1136b4f61ae25699f234)) - - +- **use:** support resetValue method and cloneResetValue option ([e4e7bed](https://github.com/varletjs/axle/commit/e4e7bedf04c0ac99936a1136b4f61ae25699f234)) # [0.4.0](https://github.com/varletjs/axle/compare/v0.3.5...v0.4.0) (2023-12-28) - ### Bug Fixes -* **use:** modify getter value behavior ([4dc8a56](https://github.com/varletjs/axle/commit/4dc8a56a42642c64ad4c4d4344197bbaf52377da)) - +- **use:** modify getter value behavior ([4dc8a56](https://github.com/varletjs/axle/commit/4dc8a56a42642c64ad4c4d4344197bbaf52377da)) ### Features -* **use:** support url getter and config getter ([5b0365b](https://github.com/varletjs/axle/commit/5b0365b081517a1edbd71ef97c15fad035356a40)) - +- **use:** support url getter and config getter ([5b0365b](https://github.com/varletjs/axle/commit/5b0365b081517a1edbd71ef97c15fad035356a40)) ### BREAKING CHANGES -* **use:** options.params, options.config behavior changes from merging to overriding - - +- **use:** options.params, options.config behavior changes from merging to overriding ## [0.3.5](https://github.com/varletjs/axle/compare/v0.3.4...v0.3.5) (2023-12-21) - - ## [0.3.4](https://github.com/varletjs/axle/compare/v0.3.3...v0.3.4) (2023-12-20) - ### Bug Fixes -* fix path error in node env ([af9df06](https://github.com/varletjs/axle/commit/af9df061122b41d5dec674104867c90d3faf57f2)) - - +- fix path error in node env ([af9df06](https://github.com/varletjs/axle/commit/af9df061122b41d5dec674104867c90d3faf57f2)) ## [0.3.3](https://github.com/varletjs/axle/compare/v0.3.2...v0.3.3) (2023-12-20) - ### Features -* support cjs format ([2c135f3](https://github.com/varletjs/axle/commit/2c135f370b6d6a33f83c87a60825079f39ab43fb)) - - +- support cjs format ([2c135f3](https://github.com/varletjs/axle/commit/2c135f370b6d6a33f83c87a60825079f39ab43fb)) ## [0.3.2](https://github.com/varletjs/axle/compare/v0.3.1...v0.3.2) (2023-12-19) - - ## [0.3.1](https://github.com/varletjs/axle/compare/v0.3.0...v0.3.1) (2023-12-17) - ### Features -* support status ([#11](https://github.com/varletjs/axle/issues/11)) ([0ec529b](https://github.com/varletjs/axle/commit/0ec529b2c353d4d9674789a3bf30b093029f45a0)) - - +- support status ([#11](https://github.com/varletjs/axle/issues/11)) ([0ec529b](https://github.com/varletjs/axle/commit/0ec529b2c353d4d9674789a3bf30b093029f45a0)) # [0.3.0](https://github.com/varletjs/axle/compare/v0.2.18...v0.3.0) (2023-12-16) - ### Code Refactoring -* refactor mapping option to mappings ([ccaf7f5](https://github.com/varletjs/axle/commit/ccaf7f53f843e5a7b5fe68cd3ee0221f0e767140)) - +- refactor mapping option to mappings ([ccaf7f5](https://github.com/varletjs/axle/commit/ccaf7f53f843e5a7b5fe68cd3ee0221f0e767140)) ### Features -* **requestMd5Interceptor:** support path overload ([19acb60](https://github.com/varletjs/axle/commit/19acb604dc4c43398a8fed9c88a80dd92a2d4776)) -* **requestMockInterceptor:** support handler overload ([9b2ccaa](https://github.com/varletjs/axle/commit/9b2ccaaf4a9a3531d886d8a6fd9690f5376c4cb5)) - +- **requestMd5Interceptor:** support path overload ([19acb60](https://github.com/varletjs/axle/commit/19acb604dc4c43398a8fed9c88a80dd92a2d4776)) +- **requestMockInterceptor:** support handler overload ([9b2ccaa](https://github.com/varletjs/axle/commit/9b2ccaaf4a9a3531d886d8a6fd9690f5376c4cb5)) ### BREAKING CHANGES -* Mapping option is deprecated, please use mappings instead. affected interceptors are: -requestMd5Interceptor, requestMockInterceptor - - +- Mapping option is deprecated, please use mappings instead. affected interceptors are: + requestMd5Interceptor, requestMockInterceptor ## [0.2.18](https://github.com/varletjs/axle/compare/v0.2.17...v0.2.18) (2023-12-15) - ### Bug Fixes -* clone ctx fields ([03ed3db](https://github.com/varletjs/axle/commit/03ed3db94fcd9bc824064eee476daa64805e4d82)) - +- clone ctx fields ([03ed3db](https://github.com/varletjs/axle/commit/03ed3db94fcd9bc824064eee476daa64805e4d82)) ### Features -* support requestMd5Interceptor ([313ae02](https://github.com/varletjs/axle/commit/313ae022acb81dd6869c4a06a412a9947ea9fbe5)) - - +- support requestMd5Interceptor ([313ae02](https://github.com/varletjs/axle/commit/313ae022acb81dd6869c4a06a412a9947ea9fbe5)) ## [0.2.17](https://github.com/varletjs/axle/compare/v0.2.16...v0.2.17) (2023-12-09) - - ## [0.2.16](https://github.com/varletjs/axle/compare/v0.2.15...v0.2.16) (2023-12-08) - ### Bug Fixes -* restore peer ([4c6d0ce](https://github.com/varletjs/axle/commit/4c6d0cea83899c7287ef5db61111a3abd422af58)) - - +- restore peer ([4c6d0ce](https://github.com/varletjs/axle/commit/4c6d0cea83899c7287ef5db61111a3abd422af58)) ## [0.2.15](https://github.com/varletjs/axle/compare/v0.2.14...v0.2.15) (2023-12-08) - ### Bug Fixes -* move vue to optionalDependencies ([8e227db](https://github.com/varletjs/axle/commit/8e227db0f243b49624a9d6e8fbd02a0a002eaa7a)) - - +- move vue to optionalDependencies ([8e227db](https://github.com/varletjs/axle/commit/8e227db0f243b49624a9d6e8fbd02a0a002eaa7a)) ## [0.2.14](https://github.com/varletjs/axle/compare/v0.2.13...v0.2.14) (2023-12-08) - ### Features -* support default immediate config ([02d16eb](https://github.com/varletjs/axle/commit/02d16eb05e3c513332b5f5297015f2a71bed439c)) - - +- support default immediate config ([02d16eb](https://github.com/varletjs/axle/commit/02d16eb05e3c513332b5f5297015f2a71bed439c)) ## [0.2.13](https://github.com/varletjs/axle/compare/v0.2.12...v0.2.13) (2023-12-07) - ### Bug Fixes -* rename responseStatusInterceptor api ([d1e5b43](https://github.com/varletjs/axle/commit/d1e5b430855dd9b80880ad019abadf28a9cfc005)) - - +- rename responseStatusInterceptor api ([d1e5b43](https://github.com/varletjs/axle/commit/d1e5b430855dd9b80880ad019abadf28a9cfc005)) ## [0.2.12](https://github.com/varletjs/axle/compare/v0.2.11...v0.2.12) (2023-12-07) - ### Features -* support responseStatusInterceptor ([#8](https://github.com/varletjs/axle/issues/8)) ([04f3778](https://github.com/varletjs/axle/commit/04f37781ca8fbbc088cec9ea2f22982757077f1f)) - - +- support responseStatusInterceptor ([#8](https://github.com/varletjs/axle/issues/8)) ([04f3778](https://github.com/varletjs/axle/commit/04f37781ca8fbbc088cec9ea2f22982757077f1f)) ## [0.2.11](https://github.com/varletjs/axle/compare/v0.2.10...v0.2.11) (2023-12-06) - ### Features -* support requestMockInterceptor ([3138a7f](https://github.com/varletjs/axle/commit/3138a7fea17431b399f433707260ac69bd904587)) - - +- support requestMockInterceptor ([3138a7f](https://github.com/varletjs/axle/commit/3138a7fea17431b399f433707260ac69bd904587)) ## [0.2.10](https://github.com/varletjs/axle/compare/v0.2.9...v0.2.10) (2023-12-03) - - ## [0.2.9](https://github.com/varletjs/axle/compare/v0.2.8...v0.2.9) (2023-12-03) - ### Features -* support matcher ([d50c5ce](https://github.com/varletjs/axle/commit/d50c5ced3c9e97b502c24a3c4246ca7b73cd06e2)) - - +- support matcher ([d50c5ce](https://github.com/varletjs/axle/commit/d50c5ced3c9e97b502c24a3c4246ca7b73cd06e2)) ## [0.2.8](https://github.com/varletjs/axle/compare/v0.2.7...v0.2.8) (2023-12-03) - ### Features -* support retry interceptor and fix types error ([f47a462](https://github.com/varletjs/axle/commit/f47a4629454d6b1db013d7f0f7fdb88b85babb88)) - - +- support retry interceptor and fix types error ([f47a462](https://github.com/varletjs/axle/commit/f47a4629454d6b1db013d7f0f7fdb88b85babb88)) ## [0.2.7](https://github.com/varletjs/axle/compare/v0.2.6...v0.2.7) (2023-12-02) - ### Features -* support matcher for interceptor ([f58a7df](https://github.com/varletjs/axle/commit/f58a7df2ff1f55722781777f12ab087087f0b7a6)) - - +- support matcher for interceptor ([f58a7df](https://github.com/varletjs/axle/commit/f58a7df2ff1f55722781777f12ab087087f0b7a6)) ## [0.2.6](https://github.com/varletjs/axle/compare/v0.2.5...v0.2.6) (2023-12-01) - ### Bug Fixes -* replace || with ?? ([34fd2c8](https://github.com/varletjs/axle/commit/34fd2c88b906bbdfa337b7483a72617f84791730)) - +- replace || with ?? ([34fd2c8](https://github.com/varletjs/axle/commit/34fd2c88b906bbdfa337b7483a72617f84791730)) ### Features -* add built-in timeout interceptor ([#4](https://github.com/varletjs/axle/issues/4)) ([255236f](https://github.com/varletjs/axle/commit/255236f1796eeb31fb6c15864396b640719a2feb)) - - +- add built-in timeout interceptor ([#4](https://github.com/varletjs/axle/issues/4)) ([255236f](https://github.com/varletjs/axle/commit/255236f1796eeb31fb6c15864396b640719a2feb)) ## [0.2.5](https://github.com/varletjs/axle/compare/v0.2.4...v0.2.5) (2023-11-30) - ### Features -* support rest args for interceptor ([74cf8bf](https://github.com/varletjs/axle/commit/74cf8bf60bc796a6f7567463c0587db588fb86c7)) - - +- support rest args for interceptor ([74cf8bf](https://github.com/varletjs/axle/commit/74cf8bf60bc796a6f7567463c0587db588fb86c7)) ## [0.2.4](https://github.com/varletjs/axle/compare/v0.2.3...v0.2.4) (2023-11-30) - ### Bug Fixes -* rename data to onResponse ([d153a79](https://github.com/varletjs/axle/commit/d153a79033954aeb283f96ba11eae8ffbac61e32)) - +- rename data to onResponse ([d153a79](https://github.com/varletjs/axle/commit/d153a79033954aeb283f96ba11eae8ffbac61e32)) ### Features -* support interceptors system ([76b5fb5](https://github.com/varletjs/axle/commit/76b5fb57dbd76986e881bff9de0ad4f61738bf65)) -* support options.axiosInterceptorOptions ([7a53a4e](https://github.com/varletjs/axle/commit/7a53a4ee21ff1045cc8be467209e9491a65e2342)) - - +- support interceptors system ([76b5fb5](https://github.com/varletjs/axle/commit/76b5fb57dbd76986e881bff9de0ad4f61738bf65)) +- support options.axiosInterceptorOptions ([7a53a4e](https://github.com/varletjs/axle/commit/7a53a4ee21ff1045cc8be467209e9491a65e2342)) ## [0.2.3](https://github.com/varletjs/axle/compare/v0.2.2...v0.2.3) (2023-11-29) - ### Features -* support resetValue ([f67b1c0](https://github.com/varletjs/axle/commit/f67b1c0af17c36e05a628d42bcdf1ce77ecef73c)) - - +- support resetValue ([f67b1c0](https://github.com/varletjs/axle/commit/f67b1c0af17c36e05a628d42bcdf1ce77ecef73c)) ## [0.2.2](https://github.com/varletjs/axle/compare/v0.2.1...v0.2.2) (2023-11-29) - ### Features -* support params getter ([3552ec7](https://github.com/varletjs/axle/commit/3552ec7cb92f4ca317394b511e6122e661c5bbc2)) - - +- support params getter ([3552ec7](https://github.com/varletjs/axle/commit/3552ec7cb92f4ca317394b511e6122e661c5bbc2)) ## [0.2.1](https://github.com/varletjs/axle/compare/v0.2.0...v0.2.1) (2023-09-13) - ### Bug Fixes -* fix playground api invoke ([8535023](https://github.com/varletjs/axle/commit/8535023b54aa9d0da30224e385c936f53019f764)) - - +- fix playground api invoke ([8535023](https://github.com/varletjs/axle/commit/8535023b54aa9d0da30224e385c936f53019f764)) # [0.2.0](https://github.com/varletjs/axle/compare/v0.1.2...v0.2.0) (2023-09-12) - - ## [0.1.2](https://github.com/varletjs/axle/compare/v0.1.1...v0.1.2) (2023-07-21) - - ## [0.1.1](https://github.com/varletjs/axle/compare/v0.1.0...v0.1.1) (2023-07-21) - - # [0.1.0](https://github.com/varletjs/axle/compare/v0.0.26...v0.1.0) (2023-07-21) - ### Features -* support more utils ([f0a7992](https://github.com/varletjs/axle/commit/f0a7992337c8988e465483aa33158fc952188ca6)) - - +- support more utils ([f0a7992](https://github.com/varletjs/axle/commit/f0a7992337c8988e465483aa33158fc952188ca6)) ## [0.0.26](https://github.com/varletjs/axle/compare/v0.0.25...v0.0.26) (2023-07-20) - ### Features -* rename postJSON ([35236b9](https://github.com/varletjs/axle/commit/35236b96d292507052d371441e0ef1d47946ee15)) - - +- rename postJSON ([35236b9](https://github.com/varletjs/axle/commit/35236b96d292507052d371441e0ef1d47946ee15)) ## [0.0.25](https://github.com/varletjs/axle/compare/v0.0.24...v0.0.25) (2023-07-06) - ### Bug Fixes -* fix args ([e312004](https://github.com/varletjs/axle/commit/e3120048696da1dd7f5653d1b709f9c914b989b3)) - +- fix args ([e312004](https://github.com/varletjs/axle/commit/e3120048696da1dd7f5653d1b709f9c914b989b3)) ### Features -* support retry ([aae87f0](https://github.com/varletjs/axle/commit/aae87f013d10668479c4f8f8838c4918ec0e734a)) - - +- support retry ([aae87f0](https://github.com/varletjs/axle/commit/aae87f013d10668479c4f8f8838c4918ec0e734a)) ## [0.0.24](https://github.com/varletjs/axle/compare/v0.0.23...v0.0.24) (2023-07-06) - ### Bug Fixes -* update ([e8f7e69](https://github.com/varletjs/axle/commit/e8f7e695ef4c6f7bd61f633cc8c8d17bdf3bc965)) - +- update ([e8f7e69](https://github.com/varletjs/axle/commit/e8f7e695ef4c6f7bd61f633cc8c8d17bdf3bc965)) ### Features -* support abort and progress ([54ee3c3](https://github.com/varletjs/axle/commit/54ee3c3c5de6c3c4222dcf11ddc60d04fd70e1b2)) - - +- support abort and progress ([54ee3c3](https://github.com/varletjs/axle/commit/54ee3c3c5de6c3c4222dcf11ddc60d04fd70e1b2)) ## [0.0.23](https://github.com/varletjs/axle/compare/v0.0.22...v0.0.23) (2023-07-05) - ### Bug Fixes -* fix onError ([82fb1da](https://github.com/varletjs/axle/commit/82fb1daf6b6fcc46e5665603dd08180583d77cac)) - - +- fix onError ([82fb1da](https://github.com/varletjs/axle/commit/82fb1daf6b6fcc46e5665603dd08180583d77cac)) ## [0.0.22](https://github.com/varletjs/axle/compare/v0.0.21...v0.0.22) (2023-07-05) - - ## [0.0.21](https://github.com/varletjs/axle/compare/v0.0.20...v0.0.21) (2023-07-04) - - ## [0.0.20](https://github.com/varletjs/axle/compare/v0.0.19...v0.0.20) (2023-07-04) - - ## [0.0.19](https://github.com/varletjs/axle/compare/v0.0.18...v0.0.19) (2023-07-04) - - ## [0.0.18](https://github.com/varletjs/axle/compare/v0.0.17...v0.0.18) (2023-07-04) - - ## [0.0.17](https://github.com/varletjs/axle/compare/v0.0.16...v0.0.17) (2023-07-04) - - ## [0.0.16](https://github.com/varletjs/axle/compare/v0.0.15...v0.0.16) (2023-07-04) - - ## [0.0.15](https://github.com/varletjs/axle/compare/v0.0.14...v0.0.15) (2023-07-03) - - ## [0.0.14](https://github.com/varletjs/axle/compare/v0.0.13...v0.0.14) (2023-07-03) - ### Features -* support prevError ([02780eb](https://github.com/varletjs/axle/commit/02780eb85486369b555f99b9fb7f51bda6dfde48)) - - +- support prevError ([02780eb](https://github.com/varletjs/axle/commit/02780eb85486369b555f99b9fb7f51bda6dfde48)) ## [0.0.13](https://github.com/varletjs/axle/compare/v0.0.12...v0.0.13) (2023-07-03) - - ## [0.0.12](https://github.com/varletjs/axle/compare/v0.0.11...v0.0.12) (2023-07-03) - ### Bug Fixes -* fix params invalid ([f6196fa](https://github.com/varletjs/axle/commit/f6196faa6d9ba2a68135003f0afe857256fa7a0c)) - - +- fix params invalid ([f6196fa](https://github.com/varletjs/axle/commit/f6196faa6d9ba2a68135003f0afe857256fa7a0c)) ## [0.0.11](https://github.com/varletjs/axle/compare/v0.0.10...v0.0.11) (2023-07-03) - - ## [0.0.10](https://github.com/varletjs/axle/compare/v0.0.9...v0.0.10) (2023-07-03) - ### Features -* support prevData for dataFormatter ([e65c889](https://github.com/varletjs/axle/commit/e65c8898e9334e3bad634d0a0c99c7717f4ae0fa)) - - +- support prevData for dataFormatter ([e65c889](https://github.com/varletjs/axle/commit/e65c8898e9334e3bad634d0a0c99c7717f4ae0fa)) ## [0.0.9](https://github.com/varletjs/axle/compare/v0.0.8...v0.0.9) (2023-06-29) - - ## [0.0.8](https://github.com/varletjs/axle/compare/v0.0.7...v0.0.8) (2023-06-19) - - ## [0.0.7](https://github.com/varletjs/axle/compare/v0.0.6...v0.0.7) (2023-06-19) - - ## [0.0.6](https://github.com/varletjs/axle/compare/v0.0.5...v0.0.6) (2023-06-19) - - ## [0.0.5](https://github.com/varletjs/axle/compare/v0.0.4...v0.0.5) (2023-06-02) - - ## [0.0.4](https://github.com/varletjs/axle/compare/v0.0.3...v0.0.4) (2023-06-02) - ### Bug Fixes -* fix config ([04f3a48](https://github.com/varletjs/axle/commit/04f3a4832ae6ce3950bf34898ce712119d342db4)) - +- fix config ([04f3a48](https://github.com/varletjs/axle/commit/04f3a4832ae6ce3950bf34898ce712119d342db4)) ### Features -* support useAxleHelper ([477d9fc](https://github.com/varletjs/axle/commit/477d9fcce5de8837072bfa31c4b9f906ce0327f6)) - - +- support useAxleHelper ([477d9fc](https://github.com/varletjs/axle/commit/477d9fcce5de8837072bfa31c4b9f906ce0327f6)) ## [0.0.3](https://github.com/varletjs/axle/compare/v0.0.2...v0.0.3) (2022-06-30) - ### Bug Fixes -* fix arraybuffer errs ([d7eeeef](https://github.com/varletjs/axle/commit/d7eeeefddc063414b5b8ef9a4c4e622a3cf34dcc)) - - +- fix arraybuffer errs ([d7eeeef](https://github.com/varletjs/axle/commit/d7eeeefddc063414b5b8ef9a4c4e622a3cf34dcc)) ## [0.0.2](https://github.com/varletjs/axle/compare/v0.0.1...v0.0.2) (2022-04-11) - - ## [0.0.1](https://github.com/varletjs/axle/compare/cb1ecbda73212fd99a269f4f8dee2de5c354fc3f...v0.0.1) (2022-03-27) - ### Features -* finish axle develop ([cb1ecbd](https://github.com/varletjs/axle/commit/cb1ecbda73212fd99a269f4f8dee2de5c354fc3f)) - - - +- finish axle develop ([cb1ecbd](https://github.com/varletjs/axle/commit/cb1ecbda73212fd99a269f4f8dee2de5c354fc3f)) diff --git a/README.md b/README.md index 999869b..80b71e1 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ axios.interceptors.request.use( (error) => { // Do something with request error return Promise.reject(error) - } + }, ) // Add a response interceptor @@ -71,7 +71,7 @@ axios.interceptors.response.use( // Any status codes that falls outside the range of 2xx cause this function to trigger // Do something with response error return Promise.reject(error) - } + }, ) ``` @@ -218,21 +218,17 @@ const headersInterceptor = requestHeadersInterceptor({ headers: () => ({ token: localStorage.getItem('token'), 'Axle-Custom-Header': 'Axle-Custom-Header', - }) + }), }) const retryInterceptor = responseRetryInterceptor({ count: 3 }) axios.interceptors.request.use( - headersInterceptor.onFulfilled, - headersInterceptor.onRejected, - headersInterceptor.options -) -axios.interceptors.response.use( - retryInterceptor.onFulfilled, - retryInterceptor.onRejected, - retryInterceptor.options + headersInterceptor.onFulfilled, + headersInterceptor.onRejected, + headersInterceptor.options, ) +axios.interceptors.response.use(retryInterceptor.onFulfilled, retryInterceptor.onRejected, retryInterceptor.options) ``` ### axle @@ -262,25 +258,25 @@ It is used to request filtering to determine what request should apply the inter ```ts axle.useResponseInterceptor( - responseRetryInterceptor({ + responseRetryInterceptor({ count: 3, include: ['method:put', 'method:post', 'status:500'], - exclude: ['/system/**', '/user/addUser', 'status:400'] + exclude: ['/system/**', '/user/addUser', 'status:400'], }), ) ``` ### List of built-in interceptor -| Name | Description | -| --- | --- | -| [requestHeadersInterceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/requestHeadersInterceptor.md) | Used to customize the request header | -| [requestMockInterceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/requestMockInterceptor.md) | Used to mock data | -| [requestMd5Interceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/requestMd5Interceptor.md) | Used for md encryption of parameters and headers | -| [responseRetryInterceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/responseRetryInterceptor.md) | Used to realize the request abnormal retry | -| [responseStatusInterceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/responseStatusInterceptor.md) | Used to intercept status code | -| [responseBlobInterceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/responseBlobInterceptor.md) | Used to intercept blob type | -| [responseTimeoutInterceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/responseTimeoutInterceptor.md) | Used to abnormal timeout | +| Name | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | +| [requestHeadersInterceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/requestHeadersInterceptor.md) | Used to customize the request header | +| [requestMockInterceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/requestMockInterceptor.md) | Used to mock data | +| [requestMd5Interceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/requestMd5Interceptor.md) | Used for md encryption of parameters and headers | +| [responseRetryInterceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/responseRetryInterceptor.md) | Used to realize the request abnormal retry | +| [responseStatusInterceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/responseStatusInterceptor.md) | Used to intercept status code | +| [responseBlobInterceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/responseBlobInterceptor.md) | Used to intercept blob type | +| [responseTimeoutInterceptor](https://github.com/varletjs/axle/blob/main/packages/axle/src/interceptors/examples/responseTimeoutInterceptor.md) | Used to abnormal timeout | ## Vue Composition API @@ -288,64 +284,64 @@ Axle provides the usage of Vue Composition API style, which encapsulates the `lo ```html