feat: 前端增加token免续命白名单
This commit is contained in:
parent
65c4b67e68
commit
aca2a9b19f
@ -15,5 +15,9 @@ module.exports = {
|
||||
* @description Whether show the logo in sidebar
|
||||
*/
|
||||
sidebarLogo: false,
|
||||
showSettings: true
|
||||
showSettings: true,
|
||||
interruptTokenContineUrls: [
|
||||
'/api/sys_msg/list/',
|
||||
'/dataset/taskLog/list/'
|
||||
]
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import i18n from '@/lang'
|
||||
import { tryShowLoading, tryHideLoading } from './loading'
|
||||
import { getLinkToken, setLinkToken } from '@/utils/auth'
|
||||
// import router from '@/router'
|
||||
|
||||
const interruptTokenContineUrls = Config.interruptTokenContineUrls
|
||||
const TokenKey = Config.TokenKey
|
||||
const RefreshTokenKey = Config.RefreshTokenKey
|
||||
const LinkTokenKey = Config.LinkTokenKey
|
||||
@ -74,7 +74,7 @@ const checkAuth = response => {
|
||||
})
|
||||
}
|
||||
// token到期后自动续命 刷新token
|
||||
if (response.headers[RefreshTokenKey]) {
|
||||
if (response.headers[RefreshTokenKey] && !interruptTokenContineUrls.some(item => response.config.url.indexOf(item) >= 0)) {
|
||||
const refreshToken = response.headers[RefreshTokenKey]
|
||||
store.dispatch('user/refreshToken', refreshToken)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user