update pay ui

This commit is contained in:
2025-12-13 16:30:50 +08:00
parent ed9d49da01
commit 4ccd43f025
17 changed files with 67 additions and 43 deletions

View File

@@ -4,6 +4,7 @@ import { useNavigate } from 'react-router-dom';
import { useToast } from '@chakra-ui/react';
import { logger } from '@utils/logger';
import { performanceMonitor } from '@utils/performanceMonitor';
import { getApiBase } from '@utils/apiConfig';
import { useNotification } from '@contexts/NotificationContext';
// ⚡ PostHog 延迟加载:移除同步导入,首屏减少 ~180KB
// import { identifyUser, resetUser, trackEvent } from '@lib/posthog';
@@ -119,7 +120,7 @@ export const AuthProvider = ({ children }) => {
controller.abort(new Error('Session check timeout after 5 seconds'));
}, 5000); // 5秒超时
const response = await fetch(`/api/auth/session`, {
const response = await fetch(`${getApiBase()}/api/auth/session`, {
method: 'GET',
credentials: 'include',
headers: {
@@ -251,7 +252,7 @@ export const AuthProvider = ({ children }) => {
loginType
});
const response = await fetch(`/api/auth/login`, {
const response = await fetch(`${getApiBase()}/api/auth/login`, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
@@ -315,7 +316,7 @@ export const AuthProvider = ({ children }) => {
try {
setIsLoading(true);
const response = await fetch(`/api/auth/register/phone`, {
const response = await fetch(`${getApiBase()}/api/auth/register/phone`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@@ -370,7 +371,7 @@ export const AuthProvider = ({ children }) => {
// 发送手机验证码
const sendSmsCode = async (phone) => {
try {
const response = await fetch(`/api/auth/send-sms-code`, {
const response = await fetch(`${getApiBase()}/api/auth/send-sms-code`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@@ -400,7 +401,7 @@ export const AuthProvider = ({ children }) => {
const logout = async () => {
try {
// 调用后端登出API
await fetch(`/api/auth/logout`, {
await fetch(`${getApiBase()}/api/auth/logout`, {
method: 'POST',
credentials: 'include'
});