refactor(auth): 移除登录时间戳的本地存储并更新错误信息语言
移除登录时间戳的本地存储,以减少不必要的存储操作。同时将错误信息从英文更新为中文,以提高代码的可读性和本地化支持。
Showing
1 changed file
with
4 additions
and
4 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2025-03-20 21:11:31 | 2 | * @Date: 2025-03-20 21:11:31 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-03-26 16:33:19 | 4 | + * @LastEditTime: 2025-05-23 09:50:46 |
| 5 | * @FilePath: /mlaj/src/contexts/auth.js | 5 | * @FilePath: /mlaj/src/contexts/auth.js |
| 6 | * @Description: 认证上下文管理模块,提供用户认证状态管理、登录登出功能 | 6 | * @Description: 认证上下文管理模块,提供用户认证状态管理、登录登出功能 |
| 7 | */ | 7 | */ |
| ... | @@ -85,9 +85,9 @@ export function provideAuth() { | ... | @@ -85,9 +85,9 @@ export function provideAuth() { |
| 85 | try { | 85 | try { |
| 86 | // 持久化存储用户信息和登录时间戳 | 86 | // 持久化存储用户信息和登录时间戳 |
| 87 | localStorage.setItem('currentUser', JSON.stringify(userData)) | 87 | localStorage.setItem('currentUser', JSON.stringify(userData)) |
| 88 | - localStorage.setItem('loginTimestamp', Date.now().toString()) | 88 | + // localStorage.setItem('loginTimestamp', Date.now().toString()) |
| 89 | } catch (error) { | 89 | } catch (error) { |
| 90 | - console.error('Failed to save user data to localStorage:', error) | 90 | + console.error('将用户数据保存到本地存储失败:', error) |
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | return true | 93 | return true |
| ... | @@ -108,7 +108,7 @@ export function provideAuth() { | ... | @@ -108,7 +108,7 @@ export function provideAuth() { |
| 108 | // localStorage.removeItem('loginTimestamp') | 108 | // localStorage.removeItem('loginTimestamp') |
| 109 | } | 109 | } |
| 110 | } catch (error) { | 110 | } catch (error) { |
| 111 | - console.error('Failed to logout:', error) | 111 | + console.error('注销失败:', error) |
| 112 | } | 112 | } |
| 113 | } | 113 | } |
| 114 | 114 | ... | ... |
-
Please register or login to post a comment