配置开发环境和生产环境的地址
This commit is contained in:
@@ -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;
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user