配置开发环境和生产环境的地址

This commit is contained in:
2026-09-30 14:22:12 +08:00
parent 064578f294
commit 5de8de007b
6 changed files with 12 additions and 6 deletions
+2
View File
@@ -0,0 +1,2 @@
export const HTTP_BASE_URL = process.env.VUE_APP_HTTP_BASE_URL;
export const WS_URL = process.env.VUE_APP_WS_URL;
+2 -2
View File
@@ -1,6 +1,7 @@
import axios from 'axios';
import store from '../store';
import router from '../router';
import { HTTP_BASE_URL } from "./config"
let redirectingToLogin = false;
@@ -25,8 +26,7 @@ function redirectToLogin() {
// 配置请求
const request = axios.create({
// baseURL: process.env.REACT_APP_API_BASE_URL,
baseURL: "/api",
baseURL: HTTP_BASE_URL,
timeout: 10000,
});
+2 -3
View File
@@ -1,7 +1,6 @@
let ws = null;
import { WS_URL } from "./config";
// WebSocket连接地址
const WS_URL = "ws://localhost:3000";
let ws = null;
// 建立WebSocket连接
export function connectWebSocket(token, onMessage, onOpen, onClose, onError) {