!195 修复登录后通过登录页面无法再次登录的问题

Merge pull request !195 from lehug/master
This commit is contained in:
芋道源码 2023-08-10 13:22:56 +00:00 committed by Gitee
commit 6e5286f94d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 5 additions and 3 deletions

View File

@ -31,7 +31,7 @@ let requestList: any[] = []
// 是否正在刷新中
let isRefreshToken = false
// 请求白名单无须token的接口
const whiteList: string[] = ['/login', '/refresh-token']
const whiteList: string[] = ['/login', '/refresh-token', '/system/tenant/get-id-by-name']
// 创建axios实例
const service: AxiosInstance = axios.create({
@ -47,8 +47,7 @@ service.interceptors.request.use(
let isToken = (config!.headers || {}).isToken === false
whiteList.some((v) => {
if (config.url) {
config.url.indexOf(v) > -1
return (isToken = false)
return (isToken = config.url.indexOf(v) > -1)
}
})
if (getAccessToken() && !isToken) {

View File

@ -148,6 +148,8 @@ import { ElLoading } from 'element-plus'
import LoginFormTitle from './LoginFormTitle.vue'
import type { RouteLocationNormalizedLoaded } from 'vue-router'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()
import { useIcon } from '@/hooks/web/useIcon'
import * as authUtil from '@/utils/auth'
@ -244,6 +246,7 @@ const handleLogin = async (params) => {
if (!res) {
return
}
wsCache.delete(CACHE_KEY.USER) //
ElLoading.service({
lock: true,
text: '正在加载系统中...',