fix: API地址改为相对路径,适应不同设备访问
This commit is contained in:
@@ -78,8 +78,8 @@ function getTodayDate() {
|
|||||||
// 从后台API加载配置
|
// 从后台API加载配置
|
||||||
async function loadBackendConfig() {
|
async function loadBackendConfig() {
|
||||||
try {
|
try {
|
||||||
// 后台服务地址
|
// 使用相对路径,自动适应当前域名
|
||||||
const API_BASE = 'http://localhost:19021';
|
const API_BASE = window.location.origin;
|
||||||
const res = await fetch(`${API_BASE}/api/config`);
|
const res = await fetch(`${API_BASE}/api/config`);
|
||||||
backendConfig = await res.json();
|
backendConfig = await res.json();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user