修改登录
This commit is contained in:
1 parent
8b14195c63
commit
56d21c3a2b
5 files changed
+45
-9
No files matched your search
@@ -55,9 +55,26 @@ http.interceptors.request.use(
|
||||
config_header["CLIENT-TOC"] = "Y"
|
||||
}
|
||||
config_header["TENANT-ID"] = "1"
|
||||
if (config.url != "/sys/auth/refresh-token" && tokenStorage && tokenStorage.access_token && config_header) {
|
||||
if (
|
||||
config.url != "/sys/auth/refresh-token" &&
|
||||
tokenStorage &&
|
||||
tokenStorage.access_token &&
|
||||
config_header &&
|
||||
isDevEnv()
|
||||
) {
|
||||
config_header.Authorization = `Bearer ${tokenStorage.access_token}`
|
||||
}
|
||||
if (
|
||||
config.url != "/sys/auth/refresh-token" &&
|
||||
tokenStorage &&
|
||||
tokenStorage.accessToken &&
|
||||
config_header &&
|
||||
!isDevEnv()
|
||||
) {
|
||||
console.log("aaaa", tokenStorage)
|
||||
|
||||
config_header.Authorization = `Bearer ${tokenStorage.accessToken.tokenValue}`
|
||||
}
|
||||
if (config.custom && config.custom.showLoading) {
|
||||
LoadingInstance.count++
|
||||
LoadingInstance.count === 1 &&
|
||||
@@ -146,9 +163,11 @@ http.interceptors.response.use(
|
||||
return Promise.resolve(response.data)
|
||||
},
|
||||
(error) => {
|
||||
if (error.statusCode == 424) {
|
||||
if (error.statusCode == 424 && isDevEnv()) {
|
||||
const tokenKey = constant.storageConstant.TOKEN
|
||||
const userInfoKey = constant.storageConstant.USERINFO
|
||||
uni.removeStorageSync(tokenKey)
|
||||
uni.removeStorageSync(userInfoKey)
|
||||
uni.showToast({ title: "登录已过期,请重新登录", icon: "none" })
|
||||
isDevEnv() ? router.jump("/pages/test/login") : undefined
|
||||
return false
|
||||
|
||||
Reference in new issue
Block a user