生产管理系统 - 每5分钟提交一次刷新token的请求
This commit is contained in:
@@ -130,6 +130,7 @@ export function LoginForm({ onRegisterClick }: LoginFormProps) {
|
||||
createdAt: response.data.created_at || new Date().toISOString(),
|
||||
// 重要:存储token到用户对象中
|
||||
token: response.data.access_token || response.data.token || null,
|
||||
refreshToken:response.data.refresh_token || ''
|
||||
};
|
||||
|
||||
// 打印登录成功日志
|
||||
@@ -138,7 +139,7 @@ export function LoginForm({ onRegisterClick }: LoginFormProps) {
|
||||
apiResponse: response.data,
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
|
||||
debugger
|
||||
// 验证token是否正确存储
|
||||
if (userData.token) {
|
||||
console.log('🔑 Token已存储:', userData.token.substring(0, 20) + '...');
|
||||
@@ -148,11 +149,8 @@ export function LoginForm({ onRegisterClick }: LoginFormProps) {
|
||||
|
||||
login(userData);
|
||||
toast.success('登录成功!正在跳转...');
|
||||
|
||||
// 跳转到个人中心页面
|
||||
setTimeout(() => {
|
||||
window.location.href = '/central-config/personal-center/personal-info';
|
||||
}, 1000);
|
||||
} else {
|
||||
dispatch({ type: 'SET_ERROR', payload: '登录失败,请检查用户名和密码' });
|
||||
toast.error('登录失败,请检查用户名和密码');
|
||||
|
||||
Reference in New Issue
Block a user