Commit 0d3ac9d9 by 黄南光

修复前端接口地址被域名替换的问题

API_BASE 优先读取 NEXT_PUBLIC_API_URL,避免按访问域名拼接接口地址
1 parent e4759251
......@@ -171,7 +171,7 @@ export default function EnterpriseWiki() {
// Selection state
const [selectedIds, setSelectedIds] = useState<Set<string>>(new Set());
const API_BASE = typeof window !== 'undefined' ? `http://${window.location.hostname}:8104` : "http://127.0.0.1:8104";
const API_BASE = process.env.NEXT_PUBLIC_API_URL || (typeof window !== 'undefined' ? `http://${window.location.hostname}:8104` : "http://127.0.0.1:8104");
const fetchFiles = async (page = currentPage, size = pageSize, search = searchQuery, isInitial = false) => {
if (isInitial) setIsInitialLoading(true);
......
......@@ -6,7 +6,7 @@ import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import { cn } from "@/lib/utils";
const API_BASE = typeof window !== 'undefined' ? `http://${window.location.hostname}:8104` : "http://127.0.0.1:8104";
const API_BASE = process.env.NEXT_PUBLIC_API_URL || (typeof window !== 'undefined' ? `http://${window.location.hostname}:8104` : "http://127.0.0.1:8104");
interface TreeNodeData {
name: string;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!