Skip to content

Commit

Permalink
🚧 修复多协议问题 (#71)
Browse files Browse the repository at this point in the history
* 修复多协议问题
  • Loading branch information
Cairry authored Dec 2, 2024
1 parent eae5397 commit 9a9862c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/utils/http.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
* 网络请求配置
*/
import axios from 'axios';
const protocol = window.location.protocol;
const curUrl = window.location.hostname
const port = window.location.port;
const type = process.env.REACT_APP_TYPE
axios.defaults.timeout = 100000;
if (type === "local"){
axios.defaults.baseURL = 'http://' + curUrl+":"+9001;

if (type === "local") {
axios.defaults.baseURL = `${protocol}//${curUrl}:${9001}`; // 本地开发端口为 9001
} else {
axios.defaults.baseURL = 'http://' + curUrl+":"+port;
axios.defaults.baseURL = `${protocol}//${curUrl}:${port}`; // 使用当前端口
}
// axios.defaults.baseURL = 'http://127.0.0.1:9001/;

/**
* http request 拦截器
*/
Expand Down

0 comments on commit 9a9862c

Please sign in to comment.