hookehuyr

fix(登出): 更新登出逻辑以使用环境变量中的基础路径

修改登出功能,使用 `window.location.href` 跳转至环境变量 `VITE_BASE` 指定的路径,确保登出后正确重定向。同时,移除清理 `loginTimestamp` 的逻辑,避免不必要的操作。
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:26:14 4 + * @LastEditTime: 2025-03-26 16:33:19
5 * @FilePath: /mlaj/src/contexts/auth.js 5 * @FilePath: /mlaj/src/contexts/auth.js
6 * @Description: 认证上下文管理模块,提供用户认证状态管理、登录登出功能 6 * @Description: 认证上下文管理模块,提供用户认证状态管理、登录登出功能
7 */ 7 */
...@@ -105,7 +105,7 @@ export function provideAuth() { ...@@ -105,7 +105,7 @@ export function provideAuth() {
105 currentUser.value = null 105 currentUser.value = null
106 // 清理本地存储的用户信息和登录时间戳 106 // 清理本地存储的用户信息和登录时间戳
107 localStorage.removeItem('currentUser') 107 localStorage.removeItem('currentUser')
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('Failed to logout:', error)
......
...@@ -242,7 +242,7 @@ const handleCheckInSuccess = () => { ...@@ -242,7 +242,7 @@ const handleCheckInSuccess = () => {
242 // Handle logout 242 // Handle logout
243 const handleLogout = () => { 243 const handleLogout = () => {
244 logout(); 244 logout();
245 - router.push("/"); 245 + window.location.href = import.meta.env.VITE_BASE || '/';
246 }; 246 };
247 247
248 // Handle menu item click 248 // Handle menu item click
......