Skip to content

Commit 6e5286f

Browse files
YunaiVgitee-org
authored andcommitted
!195 修复登录后通过登录页面无法再次登录的问题
Merge pull request !195 from lehug/master
2 parents bcca3ee + 280f734 commit 6e5286f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/config/axios/service.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ let requestList: any[] = []
3131
// 是否正在刷新中
3232
let isRefreshToken = false
3333
// 请求白名单,无须token的接口
34-
const whiteList: string[] = ['/login', '/refresh-token']
34+
const whiteList: string[] = ['/login', '/refresh-token', '/system/tenant/get-id-by-name']
3535

3636
// 创建axios实例
3737
const service: AxiosInstance = axios.create({
@@ -47,8 +47,7 @@ service.interceptors.request.use(
4747
let isToken = (config!.headers || {}).isToken === false
4848
whiteList.some((v) => {
4949
if (config.url) {
50-
config.url.indexOf(v) > -1
51-
return (isToken = false)
50+
return (isToken = config.url.indexOf(v) > -1)
5251
}
5352
})
5453
if (getAccessToken() && !isToken) {

src/views/Login/components/LoginForm.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ import { ElLoading } from 'element-plus'
148148
import LoginFormTitle from './LoginFormTitle.vue'
149149
import type { RouteLocationNormalizedLoaded } from 'vue-router'
150150
151+
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
152+
const { wsCache } = useCache()
151153
import { useIcon } from '@/hooks/web/useIcon'
152154
153155
import * as authUtil from '@/utils/auth'
@@ -244,6 +246,7 @@ const handleLogin = async (params) => {
244246
if (!res) {
245247
return
246248
}
249+
wsCache.delete(CACHE_KEY.USER) // 清除上次登录用户信息
247250
ElLoading.service({
248251
lock: true,
249252
text: '正在加载系统中...',

0 commit comments

Comments
 (0)