修复API请求使用相对路径

This commit is contained in:
Kevin Wong
2026-01-14 17:40:20 +08:00
parent b1c3d25298
commit fa1ea74f97
3 changed files with 3 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ const nextConfig: NextConfig = {
return [
{
source: '/api/:path*',
destination: 'http://127.0.0.1:8006/api/:path*',
destination: 'http://localhost:8006/api/:path*', // 服务器本地代理
},
];
},

View File

@@ -3,7 +3,7 @@
import { useState, useEffect } from "react";
const API_BASE = "http://127.0.0.1:8006";
const API_BASE = ""; // 使用相对路径,由 Next.js rewrite 代理到后端
// 类型定义
interface Material {

View File

@@ -3,7 +3,7 @@
import { useState, useEffect } from "react";
import Link from "next/link";
const API_BASE = "http://127.0.0.1:8006";
const API_BASE = ""; // 使用相对路径,由 Next.js rewrite 代理到后端
interface Account {
platform: string;