fix(login): 退出登录/切号彻底清除 uid 与 username 登录态
logout=1 仅清 token,uid 残留会被 main.ts 守卫当已登录自动带回首页,导致退出无效
This commit is contained in:
@@ -178,8 +178,11 @@ async function submitLogin() {
|
||||
onMounted(() => {
|
||||
const params = new URLSearchParams(window.location.search || '')
|
||||
if (params.get('logout') === '1' || params.get('switch') === '1') {
|
||||
// 登出/切号:uid 不彻底清除会被路由守卫当“已登录”自动带回首页(见 src/main.ts 守卫)
|
||||
try {
|
||||
window.localStorage.removeItem(AUTH_TOKEN_KEY)
|
||||
window.localStorage.removeItem('uid')
|
||||
window.localStorage.removeItem('username')
|
||||
} catch {
|
||||
/* 忽略 */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user