Commit 9c20949a by 李君

atoken失效重新登录

1 parent ee70e377
......@@ -15,6 +15,20 @@ axiosInstance.interceptors.request.use(
config => {
// Cookies.set('atoken','90eeca8f-7d7e-4dfa-8d7b-468e033dd048')
if(!Cookies.get('atoken')){
ElMessage({
message: `登录过期,请重新登录`,
type: 'warning'
})
setTimeout(()=>{
let url = ['localhost', '192.168.1.174'].includes(window.location.hostname) ? 'http://36.112.68.214:33333/' : window.location.origin
if(url.includes('36.112.68.214')){
url = 'http://36.112.68.214:33333/'
}
window.location.href=url;
},300)
return
}
config.headers.Authorization = Cookies.get('atoken')
return config
......@@ -30,10 +44,13 @@ axiosInstance.interceptors.response.use(
message: `登录过期,请重新登录`,
type: 'warning'
})
// setTimeout(()=>{
// let url = ['localhost', '192.168.1.174'].includes(window.location.hostname) ? 'http://36.112.68.214:33333/' : window.location.origin
// window.location.href=url;
// },300)
setTimeout(()=>{
let url = ['localhost', '192.168.1.174'].includes(window.location.hostname) ? 'http://36.112.68.214:33333/' : window.location.origin
if(url.includes('36.112.68.214')){
url = 'http://36.112.68.214:33333/'
}
window.location.href=url;
},300)
return
}
return responseData
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!