feat: 路由改造

This commit is contained in:
zdl
2025-10-17 18:59:00 +08:00
parent 02bf1ea709
commit bae4d25e24
15 changed files with 496 additions and 227 deletions

View File

@@ -34,6 +34,7 @@ import { authService } from "../../services/authService";
import AuthHeader from './AuthHeader';
import VerificationCodeInput from './VerificationCodeInput';
import WechatRegister from './WechatRegister';
import { setCurrentUser } from '../../mocks/data/users';
// 统一配置对象
const AUTH_CONFIG = {
@@ -261,6 +262,12 @@ export default function AuthFormContent() {
}
if (response.ok && data.success) {
// ⚡ Mock 模式:先在前端侧写入 localStorage确保时序正确
if (process.env.REACT_APP_ENABLE_MOCK === 'true' && data.user) {
setCurrentUser(data.user);
console.log('[Auth] 前端侧设置当前用户Mock模式:', data.user);
}
// 更新session
await checkSession();