pref: 去除开发环境配置

This commit is contained in:
zdl
2025-10-16 15:54:52 +08:00
parent ca51252fce
commit 081eb3c5c3
6 changed files with 42 additions and 57 deletions

View File

@@ -1,15 +1,10 @@
// src/services/eventService.js
// 判断当前是否是生产环境
const isProduction = process.env.NODE_ENV === 'production';
const API_BASE_URL = isProduction ? "" : process.env.REACT_APP_API_URL;
//const API_BASE_URL = process.env.REACT_APP_API_URL || "http://49.232.185.254:5001";
const apiRequest = async (url, options = {}) => {
try {
console.log(`Making API request to: ${API_BASE_URL}${url}`);
console.log(`Making API request to: ${url}`);
const response = await fetch(`${API_BASE_URL}${url}`, {
const response = await fetch(url, {
...options,
headers: {
'Content-Type': 'application/json',
@@ -322,7 +317,7 @@ export const stockService = {
}
const url = `/api/stock/${stockCode}/kline?${params.toString()}`;
console.log(`获取K线数据: ${API_BASE_URL}${url}`);
console.log(`获取K线数据: ${url}`);
const response = await apiRequest(url);
@@ -387,7 +382,7 @@ export const indexService = {
}
const url = `/api/index/${indexCode}/kline?${params.toString()}`;
console.log(`获取指数K线数据: ${API_BASE_URL}${url}`);
console.log(`获取指数K线数据: ${url}`);
const response = await apiRequest(url);
return response;
} catch (error) {