-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
85 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/utils/src/tests/mall-apifox-port/simple-axios.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import axios from "axios"; | ||
|
||
/** | ||
* 创建axios实例 | ||
* @description | ||
* 从商城项目内获取得来 | ||
* | ||
* @see https://apifox.com/apidoc/shared-c05cb8d7-e591-4d9c-aff8-11065a0ec1de/api-67132167 | ||
*/ | ||
function createAxiosInstance() { | ||
const instance = axios.create({ | ||
baseURL: "https://pcapi-xiaotuxian-front-devtest.itheima.net", | ||
|
||
/** 请求超时时间 */ | ||
timeout: 10000, | ||
|
||
/** 允许跨域 */ | ||
// withCredentials: true, | ||
}); | ||
|
||
// 使用qs序列化参数params参数 | ||
// instance.defaults.paramsSerializer = function (params) { | ||
// return qs.stringify(params); | ||
// }; | ||
|
||
return instance; | ||
} | ||
|
||
function main() { | ||
axios.get("https://pcapi-xiaotuxian-front-devtest.itheima.net/home/hot").then((res) => { | ||
console.log(" ? ", res); | ||
}); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ | |
"peerDependencies": { | ||
"typescript": "catalog:" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ | |
"devDependencies": { | ||
"@ruan-cat/vuepress-preset-config": "workspace:^" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ | |
"clear": "rimraf dist .turbo .vercel .cache .temp", | ||
"rm:node_modules": "rimraf node_modules" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
"docs:update-package": "pnpm dlx vp-update", | ||
"clear": "rimraf dist && rimraf .turbo && rimraf .vercel" | ||
} | ||
} | ||
} |