Commit 9c20949a by 李君

atoken失效重新登录

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