From ab99056d1e0cc345fab93afd35a73f23b1303dde Mon Sep 17 00:00:00 2001 From: haoziqaq <357229046@qq.com> Date: Sun, 3 Dec 2023 00:52:14 +0800 Subject: [PATCH] style: format code --- .github/workflows/sync-gitee.yaml | 1 - CHANGELOG.md | 141 +- README.md | 238 ++- README.zh-CN.md | 236 ++- playground/README.md | 12 +- playground/pnpm-lock.yaml | 1255 ++++++++------ playground/vite.config.ts | 4 +- pnpm-lock.yaml | 2626 ++++++++++++++++++----------- src/index.ts | 2 +- src/useHasLoading.ts | 6 +- 10 files changed, 2649 insertions(+), 1872 deletions(-) diff --git a/.github/workflows/sync-gitee.yaml b/.github/workflows/sync-gitee.yaml index 54743d3..1afdd58 100644 --- a/.github/workflows/sync-gitee.yaml +++ b/.github/workflows/sync-gitee.yaml @@ -18,4 +18,3 @@ jobs: with: source-repo: git@github.com:varletjs/axle.git destination-repo: git@gitee.com:varlet/axle.git - diff --git a/CHANGELOG.md b/CHANGELOG.md index bbaacce..67ef40b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,255 +1,160 @@ ## [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 0e9cfe5..e92273a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -English | +English | 中文 ### Intro @@ -49,24 +49,30 @@ axios.defaults.headers.common['TOKEN'] = TOKEN axios.defaults.timeout = 2500 // Add a request interceptor -axios.interceptors.request.use((config) => { - // Do something before request is sent - return config -}, (error) => { - // Do something with request error - return Promise.reject(error) -}) +axios.interceptors.request.use( + (config) => { + // Do something before request is sent + return config + }, + (error) => { + // Do something with request error + return Promise.reject(error) + } +) // Add a response interceptor -axios.interceptors.response.use((response) => { - // Any status code that lie within the range of 2xx cause this function to trigger - // Do something with response data - return response -}, (error) => { - // Any status codes that falls outside the range of 2xx cause this function to trigger - // Do something with response error - return Promise.reject(error) -}) +axios.interceptors.response.use( + (response) => { + // Any status code that lie within the range of 2xx cause this function to trigger + // Do something with response data + return response + }, + (error) => { + // Any status codes that falls outside the range of 2xx cause this function to trigger + // Do something with response error + return Promise.reject(error) + } +) ``` ## Axle & Axios Request Functions @@ -147,10 +153,10 @@ axle.post('/url', { name: 'foo' }) ```js // axios -axios.post('/url', qs.stringify({ name: 'foo' }), { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded' - } +axios.post('/url', qs.stringify({ name: 'foo' }), { + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, }) // axle axle.postUrlEncode('/url', { name: 'foo' }) @@ -164,10 +170,10 @@ const formData = new FormData() formData.append('name', 'foo') formData.append('file', new File()) -axios.post('/url', formData, { - headers: { - 'Content-Type': 'multipart/form-data' - } +axios.post('/url', formData, { + headers: { + 'Content-Type': 'multipart/form-data', + }, }) // axle axle.postMultipart('/url', { name: 'foo', file: new File() }) @@ -197,61 +203,55 @@ Axle provides the usage of Vue Composition API style, which encapsulates the `lo ```html