解决路由回跳缺陷(1、手动退出后重新登录会错误地回到上次丢失认证时记录的路由页面;2、后端接口403时会错误地回到上次丢失认证时记录的路由页面而不是当前页面)

This commit is contained in:
Allen
2024-05-16 10:54:10 +08:00
parent 5d39d0e139
commit 49dd3f726a
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -23,7 +23,8 @@ const progressDialog = ref(false)
function logout() {
// 清除登录状态信息
store.dispatch('auth/clearToken')
// 主动登出时清除路由标记
store.state.auth.originalPath = null
// 重定向到登录页面或其他适当的页面
router.push('/login')
}