diff --git a/src/components/Auth/AuthFormContent.js b/src/components/Auth/AuthFormContent.js index 914d7fe6..d8756852 100644 --- a/src/components/Auth/AuthFormContent.js +++ b/src/components/Auth/AuthFormContent.js @@ -183,8 +183,6 @@ export default function AuthFormContent() { purpose: config.api.purpose }; - logger.api.request('POST', '/api/auth/send-verification-code', requestData); - const response = await fetch('/api/auth/send-verification-code', { method: 'POST', headers: { @@ -200,8 +198,6 @@ export default function AuthFormContent() { const data = await response.json(); - logger.api.response('POST', '/api/auth/send-verification-code', response.status, data); - if (!isMountedRef.current) return; if (!data) { @@ -306,12 +302,6 @@ export default function AuthFormContent() { login_type: 'phone', }; - logger.api.request('POST', '/api/auth/login-with-code', { - credential: cleanedPhone.substring(0, 3) + '****' + cleanedPhone.substring(7), - verification_code: verificationCode.substring(0, 2) + '****', - login_type: 'phone' - }); - // 调用API(根据模式选择不同的endpoint const response = await fetch('/api/auth/login-with-code', { method: 'POST', @@ -328,11 +318,6 @@ export default function AuthFormContent() { const data = await response.json(); - logger.api.response('POST', '/api/auth/login-with-code', response.status, { - ...data, - user: data.user ? { id: data.user.id, phone: data.user.phone } : null - }); - if (!isMountedRef.current) return; if (!data) { diff --git a/src/hooks/useAuthModal.js b/src/hooks/useAuthModal.js index 956d5d24..b5ff3976 100644 --- a/src/hooks/useAuthModal.js +++ b/src/hooks/useAuthModal.js @@ -11,7 +11,6 @@ import { selectRedirectUrl } from '../store/slices/authModalSlice'; import { useAuth } from '../contexts/AuthContext'; -import { logger } from '../utils/logger'; /** * 认证弹窗自定义 Hook @@ -49,11 +48,6 @@ export const useAuthModal = () => { const openAuthModal = useCallback((url = null, callback = null) => { onSuccessCallbackRef.current = callback; dispatch(openModal({ redirectUrl: url })); - - logger.debug('useAuthModal', '打开认证弹窗', { - redirectUrl: url || '无', - hasCallback: !!callback - }); }, [dispatch]); /** @@ -67,9 +61,6 @@ export const useAuthModal = () => { // ⭐ 如果用户关闭弹窗时仍未登录,跳转到首页 if (!isAuthenticated) { navigate('/home'); - logger.debug('useAuthModal', '未登录关闭弹窗,跳转到首页'); - } else { - logger.debug('useAuthModal', '关闭认证弹窗'); } }, [dispatch, isAuthenticated, navigate]); @@ -82,14 +73,8 @@ export const useAuthModal = () => { if (onSuccessCallbackRef.current) { try { onSuccessCallbackRef.current(user); - logger.debug('useAuthModal', '执行成功回调', { - userId: user?.id - }); } catch (error) { - logger.error('useAuthModal', 'handleLoginSuccess 回调执行失败', error, { - userId: user?.id, - hasCallback: !!onSuccessCallbackRef.current - }); + console.error('useAuthModal: handleLoginSuccess 回调执行失败', error); } } @@ -97,10 +82,6 @@ export const useAuthModal = () => { // 移除了原有的 redirectUrl 跳转逻辑 dispatch(closeModal()); onSuccessCallbackRef.current = null; - - logger.debug('useAuthModal', '登录成功,关闭弹窗', { - userId: user?.id - }); }, [dispatch]); return { diff --git a/src/store/slices/authModalSlice.js b/src/store/slices/authModalSlice.js index e8ff1696..bbe4afe4 100644 --- a/src/store/slices/authModalSlice.js +++ b/src/store/slices/authModalSlice.js @@ -2,7 +2,6 @@ // 认证弹窗状态管理 Redux Slice - 从 AuthModalContext 迁移 import { createSlice } from '@reduxjs/toolkit'; -import { logger } from '../../utils/logger'; /** * AuthModal Slice @@ -22,9 +21,6 @@ const authModalSlice = createSlice({ openModal: (state, action) => { state.isOpen = true; state.redirectUrl = action.payload?.redirectUrl || null; - logger.debug('authModalSlice', '打开认证弹窗', { - redirectUrl: action.payload?.redirectUrl || '无' - }); }, /** @@ -33,7 +29,6 @@ const authModalSlice = createSlice({ closeModal: (state) => { state.isOpen = false; state.redirectUrl = null; - logger.debug('authModalSlice', '关闭认证弹窗'); }, /**