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

@@ -37,7 +37,8 @@ import WechatRegister from './WechatRegister';
// API配置
const isProduction = process.env.NODE_ENV === 'production';
const API_BASE_URL = isProduction ? "" : "http://49.232.185.254:5001";
// 使用空字符串让请求通过 webpack proxy避免跨域 cookie 问题
const API_BASE_URL = "";
// 统一配置对象
const AUTH_CONFIG = {
@@ -154,12 +155,12 @@ export default function AuthFormContent() {
try {
setSendingCode(true);
const response = await fetch(`${API_BASE_URL}/api/auth/send-verification-code`, {
const response = await fetch('/api/auth/send-verification-code', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
credentials: 'include',
credentials: 'include', // 必须包含以支持跨域 session cookie
body: JSON.stringify({
credential,
type: 'phone',
@@ -243,12 +244,12 @@ export default function AuthFormContent() {
};
// 调用API根据模式选择不同的endpoint
const response = await fetch(`${API_BASE_URL}/api/auth/login-with-code`, {
const response = await fetch('/api/auth/login-with-code', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
credentials: 'include',
credentials: 'include', // 必须包含以支持跨域 session cookie
body: JSON.stringify(requestBody),
});