feat(config): 更新环境配置与 API 处理逻辑
修改 .env.example,补充环境切换说明并新增生产环境 API 地址配置。 更新 next.config.ts:使用 API_BASE_URL 进行 API 重写配置,确保 API 路由一致性。 重构 login-form.tsx:移除 API 配置检查逻辑,简化登录流程。 调整 admin-http.ts:通过 Next.js 代理转发 API 请求,提升后端通信稳定性。
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const apiBaseUrl = process.env.API_BASE_URL?.trim() || "http://127.0.0.1:8000";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/* config options here */
|
||||
allowedDevOrigins: ["192.168.0.101"],
|
||||
reactCompiler: true,
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: "/api/:path*",
|
||||
destination: `${apiBaseUrl}/api/:path*`,
|
||||
},
|
||||
];
|
||||
},
|
||||
async redirects() {
|
||||
return [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user