mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-10-02 05:17:24 +08:00
修复登录账号没有任何权限时跳转到403页面错误
This commit is contained in:
@@ -11,7 +11,7 @@ export function getToken() {
|
||||
export function clearAuthInfo() {
|
||||
const userStore = useUserStore()
|
||||
const tabsStore = useTabsStore()
|
||||
userStore.$reset()
|
||||
userStore.resetState()
|
||||
tabsStore.$reset()
|
||||
cache.remove(TOKEN_KEY)
|
||||
resetRouter()
|
||||
|
||||
@@ -72,10 +72,9 @@ export class Axios {
|
||||
}
|
||||
|
||||
if (err.code == AxiosError.ECONNABORTED || err.code == AxiosError.ERR_NETWORK) {
|
||||
setTimeout(() => {
|
||||
console.log(err)
|
||||
return new Promise((resolve) => setTimeout(resolve, 500)).then(() =>
|
||||
this.retryRequest(err)
|
||||
}, 500)
|
||||
)
|
||||
}
|
||||
return Promise.reject(err)
|
||||
}
|
||||
@@ -103,17 +102,17 @@ export class Axios {
|
||||
retryRequest(error: AxiosError) {
|
||||
const config = error.config
|
||||
const { retryCount, isOpenRetry } = config.requestOptions
|
||||
if (!isOpenRetry && config.method?.toUpperCase() == RequestMethodsEnum.POST) {
|
||||
return
|
||||
if (!isOpenRetry || config.method?.toUpperCase() == RequestMethodsEnum.POST) {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
config.retryCount = config.retryCount ?? 0
|
||||
|
||||
if (config.retryCount >= retryCount) {
|
||||
return
|
||||
return Promise.reject(error)
|
||||
}
|
||||
config.retryCount++
|
||||
|
||||
this.axiosInstance.request(config)
|
||||
return this.axiosInstance.request(config)
|
||||
}
|
||||
/**
|
||||
* @description get请求
|
||||
|
||||
Reference in New Issue
Block a user