pref: 去除开发环境配置
This commit is contained in:
@@ -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),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user