fix: 解决 tokne 问题

aiops_dev
时启龙 2025-08-28 14:32:03 +08:00
parent 9c0c01a9ce
commit 1a30bfe81d
1 changed files with 5 additions and 1 deletions

View File

@ -3,7 +3,7 @@
*/
import store from './store'
import router from './router'
import { getToken, setToken } from 'utils/auth'
import { getToken, setToken, removeToken } from 'utils/auth'
import { getQuery } from 'utils'
import { isEmpty, assign } from 'lodash-es'
@ -17,6 +17,10 @@ router.beforeEach(async (to, from, next) => {
if (isEmpty(history.state.current)) {
assign(history.state, { current: from.fullPath })
}
if (to.path === '/sso') {
// 进入 sso 页面默认就是没有登录
removeToken()
}
if (getToken()) {
// 判断用户是否处于登录状态
if (to.path === '/login') {